Estonian ID Card C-library
DigiDocParser.h
1 #ifndef __DIGIDOC_PARSER_H__
2 #define __DIGIDOC_PARSER_H__
3 //==================================================
4 // FILE: DigiDocParser.h
5 // PROJECT: Digi Doc
6 // DESCRIPTION: Digi Doc functions for xml parsing
7 // AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia
8 //==================================================
9 // Copyright (C) AS Sertifitseerimiskeskus
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 // GNU Lesser General Public Licence is available at
19 // http://www.gnu.org/copyleft/lesser.html
20 //==========< HISTORY >=============================
21 // 10.07.2004 Veiko Sinivee
22 // Creation
23 // 22.08.2004 Veiko Sinivee
24 // Renamed ddocExtractDataFile to ddocXRdrExtractDataFile
25 // Renamed ddocGetDataFile to ddocXRdrGetDataFile
26 // Renamed ddocCopyDataFile to ddocXRdrCopyDataFile
27 // introduced ddocXRdrReadSignedDocFromFile()
28 //==================================================
29 
30 #include <libdigidoc/DigiDocDefs.h>
31 #include <libdigidoc/DigiDocLib.h>
32 #include <libdigidoc/DigiDocMem.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 
39 
40  //--------------------------------------------------
41  // Reads in signed XML document and extracts the desired data file
42  // pSigDoc - signed document object if cached
43  // szFileName - name of digidoc file
44  // szDataFileName - name of new data file
45  // szDocId - id if DataFile
46  // szCharset - output charset
47  // szFileNameCharset - digidoc filename charset
48  //--------------------------------------------------
49  EXP_OPTION int ddocXRdrExtractDataFile(SignedDoc* pSigDoc, const char* szFileName,
50  const char* szDataFileName,
51  const char* szDocId, const char* szCharset);
52 
53  //--------------------------------------------------
54  // Reads in signed XML document and returns the
55  // desired DataFile-s content in a memory buffer.
56  // caller is responsible for freeing the memory.
57  // pSigDoc - signed document object if cached
58  // szFileName - name of digidoc file
59  // szDocId - id if DataFile
60  // pBuf - address of buffer pointer
61  // returns error code or ERR_OK
62  //--------------------------------------------------
63  EXP_OPTION int ddocXRdrGetDataFile(SignedDoc* pSigDoc, const char* szFileName,
64  const char* szDocId, DigiDocMemBuf* pBuf);
65 
66  //--------------------------------------------------
67  // Reads in signed XML document and extracts the desired data file
68  // This function keeps also <DataFile> xml tags. It is used
69  // internally to copy data content from an old digidoc file
70  // to a temp file while saving a the file
71  // pSigDoc - signed document object if cached
72  // szFileName - name of digidoc file
73  // szDataFileName - name of new data file
74  // szDocId - id if DataFile
75  // szCharset - output charset
76  //--------------------------------------------------
77  int ddocXRdrCopyDataFile(SignedDoc* pSigDoc, const char* szFileName, const char* szDataFileName,
78  const char* szDocId, const char* szCharset);
79 
80  //--------------------------------------------------
81  // Reads in signed XML document
82  // szFileName - name of digidoc file
83  // ppSigDoc - address of new signed doc pointer
84  // lMaxDFLen - maximum size of a cached DataFile
85  //--------------------------------------------------
86  EXP_OPTION int ddocXRdrReadSignedDocFromFile(const char* szFileName,
87  SignedDoc** pSigDoc, long lMaxDFLen);
88 
89 
90  //--------------------------------------------------
91  // Reads in signed XML document from memory buffer
92  // szXml - memory buffer that contains digidoc data
93  // xmlLen - length of the input data
94  // szFileNameCharset - digidoc filename charset
95  // ppSigDoc - address of new signed doc pointer
96  // lMaxDFLen - maximum size of a cached DataFile
97  //--------------------------------------------------
98  EXP_OPTION int ddocXRdrReadSignedDocFromMemory(const char* szXml, int xmlLen,
99  SignedDoc** pSigDoc, long lMaxDFLen);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 
106 #endif // __DIGIDOC_PARSER_H__
107 
Definition: DigiDocMem.h:32
Definition: DigiDocObj.h:177