Estonian ID Card C-library
DigiDocSAXParser.h
1 #ifndef __DIGIDOC_SAX_PARSER_H__
2 #define __DIGIDOC_SAX_PARSER_H__
3 //==================================================
4 // FILE: DigiDocSAXParser.h
5 // PROJECT: Digi Doc
6 // DESCRIPTION: Digi Doc functions for xml parsing using SAX interface
7 // This is the older parser and will probably
8 // be removed in new versions
9 // AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia
10 //==================================================
11 // Copyright (C) AS Sertifitseerimiskeskus
12 // This library is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU Lesser General Public
14 // License as published by the Free Software Foundation; either
15 // version 2.1 of the License, or (at your option) any later version.
16 // This library is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 // Lesser General Public License for more details.
20 // GNU Lesser General Public Licence is available at
21 // http://www.gnu.org/copyleft/lesser.html
22 //==========< HISTORY >=============================
23 // 12.08.2004 Veiko Sinivee
24 // Creation
25 // 22.08.2004 Veiko Sinivee
26 // Renamed readSignedDoc() to ddocSaxReadSignedDocFromFile(). Params changed.
27 // Renamed extractDataFile() to ddocSaxExtractDataFile(). Uses chached content.
28 //==================================================
29 
30 #include <libdigidoc/DigiDocDefs.h>
31 #include <libdigidoc/DigiDocLib.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 //--------------------------------------------------
38 // Reads in signed XML document info from digidoc file
39 // ppSigDoc - pointer to the buffer of newly read info pointer
40 // szFileName - documents filename
41 // checkFileDigest - indicates if digests of datafiles referred by the document must be checked
42 // lMaxDFLen - maximum size for a DataFile whose contents will be
43 // kept in memory
44 //--------------------------------------------------
45 EXP_OPTION int ddocSaxReadSignedDocFromFile(SignedDoc** ppSigDoc, const char* szFileName,
46  int checkFileDigest, long lMaxDFLen);
47 
48 //--------------------------------------------------
49 // Reads in signed XML document and extracts the desired data file
50 // pSigDoc - signed document object if exists. Can be NULL
51 // szFileName - digidoc filename
52 // szDataFileName - name of the file where to store embedded data.
53 // szDocId - DataFile Id atribute value
54 // szCharset - convert DataFile content to charset
55 //--------------------------------------------------
56 EXP_OPTION int ddocSaxExtractDataFile(SignedDoc* pSigDoc, const char* szFileName, const char* szDataFileName,
57  const char* szDocId, const char* szCharset);
58 
59 //--------------------------------------------------
60 // Reads in signed XML document and returns the
61 // desired DataFile-s content in a memory buffer.
62 // caller is responsible for freeing the memory.
63 // pSigDoc - signed document object if cached
64 // szFileName - name of digidoc file
65 // szDocId - id if DataFile
66 // pBuf - address of buffer pointer
67 // bKeepBase64 - 1=don't decode base64, 0=decode base64
68 // returns error code or ERR_OK
69 //--------------------------------------------------
70 EXP_OPTION int ddocSAXGetDataFile(SignedDoc* pSigDoc, const char* szFileName,
71  const char* szDocId, DigiDocMemBuf* pBuf,
72  int bKeepBase64);
73 
74 //--------------------------------------------------
75 // Reads in signed XML document info from memory buffer
76 // ppSigDoc - pointer to the buffer of newly read info pointer
77 // szFileName - documents filename
78 // checkFileDigest - indicates if digests of datafiles referred by the document must be checked
79 // lMaxDFLen - maximum size for a DataFile whose contents will be
80 // kept in memory
81 //--------------------------------------------------
82 EXP_OPTION int ddocSaxReadSignedDocFromMemory(SignedDoc** ppSigDoc, const void* pData,
83  int len, long lMaxDFLen);
84 
85 //--------------------------------------------------
86 // Reads new signatures from another digidoc file
87 // and adds to existing digidoc. Adds only those
88 // signatures that don't exist in old digidoc.
89 // pSigDoc - signed document object
90 // szFileName - name of digidoc file
91 // returns error code or ERR_OK
92 //--------------------------------------------------
93 EXP_OPTION int ddocReadNewSignaturesFromDdoc(SignedDoc* pSigDoc, const char* szFileName);
94 //AM 13.03.2008
95 void decodeURI(const char* uri, char* id, int nIdLen, char* adr, int nAdrLen);
96 
97 
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 
104 #endif // __DIGIDOC_SAX_PARSER_H__
105 
DigiDocMemBuf_st
Definition: DigiDocMem.h:32
SignedDoc_st
Definition: DigiDocObj.h:177