72911bc090162217fffdf3c3a4571bf4a423464a
[platform/upstream/libxml2.git] / os400 / libxmlrpg / xmlIO.rpgle
1       * Summary: interface for the I/O interfaces used by the parser
2       * Description: interface for the I/O interfaces used by the parser
3       *
4       * Copy: See Copyright for the status of this software.
5       *
6       * Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
7
8       /if not defined(XML_IO_H__)
9       /define XML_IO_H__
10
11       /include "libxmlrpg/xmlversion"
12
13       * Those are the functions and datatypes for the parser input
14       * I/O structures.
15
16       * xmlInputMatchCallback:
17       * @filename: the filename or URI
18       *
19       * Callback used in the I/O Input API to detect if the current handler
20       * can provide input fonctionnalities for this resource.
21       *
22       * Returns 1 if yes and 0 if another Input module should be used
23
24      d xmlInputMatchCallback...
25      d                 s               *   based(######typedef######)
26      d                                     procptr
27
28       * xmlInputOpenCallback:
29       * @filename: the filename or URI
30       *
31       * Callback used in the I/O Input API to open the resource
32       *
33       * Returns an Input context or NULL in case or error
34
35      d xmlInputOpenCallback...
36      d                 s               *   based(######typedef######)
37      d                                     procptr
38
39       * xmlInputReadCallback:
40       * @context:  an Input context
41       * @buffer:  the buffer to store data read
42       * @len:  the length of the buffer in bytes
43       *
44       * Callback used in the I/O Input API to read the resource
45       *
46       * Returns the number of bytes read or -1 in case of error
47
48      d xmlInputReadCallback...
49      d                 s               *   based(######typedef######)
50      d                                     procptr
51
52       * xmlInputCloseCallback:
53       * @context:  an Input context
54       *
55       * Callback used in the I/O Input API to close the resource
56       *
57       * Returns 0 or -1 in case of error
58
59      d xmlInputCloseCallback...
60      d                 s               *   based(######typedef######)
61      d                                     procptr
62
63       /if defined(LIBXML_OUTPUT_ENABLED)
64
65       * Those are the functions and datatypes for the library output
66       * I/O structures.
67
68       * xmlOutputMatchCallback:
69       * @filename: the filename or URI
70       *
71       * Callback used in the I/O Output API to detect if the current handler
72       * can provide output fonctionnalities for this resource.
73       *
74       * Returns 1 if yes and 0 if another Output module should be used
75
76      d xmlOutputMatchCallback...
77      d                 s               *   based(######typedef######)
78      d                                     procptr
79
80       * xmlOutputOpenCallback:
81       * @filename: the filename or URI
82       *
83       * Callback used in the I/O Output API to open the resource
84       *
85       * Returns an Output context or NULL in case or error
86
87      d xmlOutputOpenCallback...
88      d                 s               *   based(######typedef######)
89      d                                     procptr
90
91       * xmlOutputWriteCallback:
92       * @context:  an Output context
93       * @buffer:  the buffer of data to write
94       * @len:  the length of the buffer in bytes
95       *
96       * Callback used in the I/O Output API to write to the resource
97       *
98       * Returns the number of bytes written or -1 in case of error
99
100      d xmlOutputWriteCallback...
101      d                 s               *   based(######typedef######)
102      d                                     procptr
103
104       * xmlOutputCloseCallback:
105       * @context:  an Output context
106       *
107       * Callback used in the I/O Output API to close the resource
108       *
109       * Returns 0 or -1 in case of error
110
111      d xmlOutputCloseCallback...
112      d                 s               *   based(######typedef######)
113      d                                     procptr
114       /endif                                                                    LIBXML_OUTPUT_ENABLD
115
116       /include "libxmlrpg/globals"
117       /include "libxmlrpg/tree"
118       /include "libxmlrpg/parser"
119       /include "libxmlrpg/encoding"
120
121      d xmlParserInputBuffer...
122      d                 ds                  based(xmlParserInputBufferPtr)
123      d                                     align qualified
124      d  context                        *                                        void *
125      d  readcallback                       like(xmlInputReadCallback)
126      d  closecallback                      like(xmlInputCloseCallback)
127       *
128      d  encoder                            like(xmlCharEncodingHandlerPtr)      Conversions --> UTF8
129       *
130      d  buffer                             like(xmlBufPtr)                      UTF-8 local buffer
131      d  raw                                like(xmlBufPtr)                      Raw input buffer
132      d  compressed                   10i 0
133      d  error                        10i 0
134      d  rawconsumed                  20u 0
135
136       /if defined(LIBXML_OUTPUT_ENABLED)
137      d xmlOutputBuffer...
138      d                 ds                  based(xmlOutputBufferPtr)
139      d                                     align qualified
140      d  context                        *                                        void *
141      d  writecallback                      like(xmlOutputWriteCallback)
142      d  closecallback                      like(xmlOutputCloseCallback)
143       *
144      d  encoder                            like(xmlCharEncodingHandlerPtr)      Conversions --> UTF8
145       *
146      d  buffer                             like(xmlBufPtr)                      UTF-8/ISOLatin local
147      d  conv                               like(xmlBufPtr)                      Buffer for output
148      d  written                      10i 0                                      Total # byte written
149      d  error                        10i 0
150       /endif                                                                    LIBXML_OUTPUT_ENABLD
151
152       * Interfaces for input
153
154      d xmlCleanupInputCallbacks...
155      d                 pr                  extproc('xmlCleanupInputCallbacks')
156
157      d xmlPopInputCallbacks...
158      d                 pr            10i 0 extproc('xmlPopInputCallbacks')
159
160      d xmlRegisterDefaultInputCallbacks...
161      d                 pr                  extproc(
162      d                                      'xmlRegisterDefaultInputCallbacks')
163
164      d xmlAllocParserInputBuffer...
165      d                 pr                  extproc('xmlAllocParserInputBuffer')
166      d                                     like(xmlParserInputBufferPtr)
167      d  enc                                value like(xmlCharEncoding)
168
169      d xmlParserInputBufferCreateFilename...
170      d                 pr                  extproc(
171      d                                     'xmlParserInputBufferCreateFilename')
172      d                                     like(xmlParserInputBufferPtr)
173      d  URI                            *   value options(*string)               const char *
174      d  enc                                value like(xmlCharEncoding)
175
176      d xmlParserInputBufferCreateFile...
177      d                 pr                  extproc(
178      d                                      'xmlParserInputBufferCreateFile')
179      d                                     like(xmlParserInputBufferPtr)
180      d  file                           *   value                                FILE *
181      d  enc                                value like(xmlCharEncoding)
182
183      d xmlParserInputBufferCreateFd...
184      d                 pr                  extproc(
185      d                                      'xmlParserInputBufferCreateFd')
186      d                                     like(xmlParserInputBufferPtr)
187      d  fd                           10i 0 value
188      d  enc                                value like(xmlCharEncoding)
189
190      d xmlParserInputBufferCreateMem...
191      d                 pr                  extproc(
192      d                                      'xmlParserInputBufferCreateMem')
193      d                                     like(xmlParserInputBufferPtr)
194      d  mem                            *   value options(*string)               const char *
195      d  size                         10i 0 value
196      d  enc                                value like(xmlCharEncoding)
197
198      d xmlParserInputBufferCreateStatic...
199      d                 pr                  extproc(
200      d                                      'xmlParserInputBufferCreateStatic')
201      d                                     like(xmlParserInputBufferPtr)
202      d  mem                            *   value options(*string)               const char *
203      d  size                         10i 0 value
204      d  enc                                value like(xmlCharEncoding)
205
206      d xmlParserInputBufferCreateIO...
207      d                 pr                  extproc(
208      d                                      'xmlParserInputBufferCreateIO')
209      d                                     like(xmlParserInputBufferPtr)
210      d  ioread                             value like(xmlInputReadCallback)
211      d  ioclose                            value like(xmlInputCloseCallback)
212      d  ioctx                          *   value                                void *
213      d  enc                                value like(xmlCharEncoding)
214
215      d xmlParserInputBufferRead...
216      d                 pr            10i 0 extproc('xmlParserInputBufferRead')
217      d  in                                 value like(xmlParserInputBufferPtr)
218      d  len                          10i 0 value
219
220      d xmlParserInputBufferGrow...
221      d                 pr            10i 0 extproc('xmlParserInputBufferGrow')
222      d  in                                 value like(xmlParserInputBufferPtr)
223      d  len                          10i 0 value
224
225      d xmlParserInputBufferPush...
226      d                 pr            10i 0 extproc('xmlParserInputBufferPush')
227      d  in                                 value like(xmlParserInputBufferPtr)
228      d  len                          10i 0 value
229      d  buf                            *   value options(*string)               const char *
230
231      d xmlFreeParserInputBuffer...
232      d                 pr                  extproc('xmlFreeParserInputBuffer')
233      d  in                                 value like(xmlParserInputBufferPtr)
234
235      d xmlParserGetDirectory...
236      d                 pr              *   extproc('xmlParserGetDirectory')     char *
237      d  filename                       *   value options(*string)               const char *
238
239      d xmlRegisterInputCallbacks...
240      d                 pr            10i 0 extproc('xmlRegisterInputCallbacks')
241      d  matchFunc                          value like(xmlInputMatchCallback)
242      d  openFunc                           value like(xmlInputOpenCallback)
243      d  readFunc                           value like(xmlInputReadCallback)
244      d  closeFunc                          value like(xmlInputCloseCallback)
245
246       /if defined(LIBXML_OUTPUT_ENABLED)
247
248       * Interfaces for output
249
250      d xmlCleanupOutputCallbacks...
251      d                 pr                  extproc('xmlCleanupOutputCallbacks')
252
253      d xmlRegisterDefaultOutputCallbacks...
254      d                 pr                  extproc(
255      d                                      'xmlRegisterDefaultOuputCallbacks')
256
257      d xmlAllocOutputBuffer...
258      d                 pr                  extproc('xmlAllocOutputBuffer')
259      d                                     like(xmlOutputBufferPtr)
260      d  encoder                            value
261      d                                     like(xmlCharEncodingHandlerPtr)
262
263      d xmlOutputBufferCreateFilename...
264      d                 pr                  extproc(
265      d                                      'xmlOutputBufferCreateFilename')
266      d                                     like(xmlOutputBufferPtr)
267      d  URI                            *   value options(*string)               const char *
268      d  encoder                            value
269      d                                     like(xmlCharEncodingHandlerPtr)
270      d  compression                  10i 0 value
271
272      d xmlOutputBufferCreateFile...
273      d                 pr                  extproc('xmlOutputBufferCreateFile')
274      d                                     like(xmlOutputBufferPtr)
275      d  file                           *   value                                FILE *
276      d  encoder                            value
277      d                                     like(xmlCharEncodingHandlerPtr)
278
279      d xmlOutputBufferCreateBuffer...
280      d                 pr                  extproc(
281      d                                      'xmlOutputBufferCreateBuffer')
282      d                                     like(xmlOutputBufferPtr)
283      d  buffer                             value like(xmlBufferPtr)
284      d  encoder                            value
285      d                                     like(xmlCharEncodingHandlerPtr)
286
287      d xmlOutputBufferCreateFd...
288      d                 pr                  extproc('xmlOutputBufferCreateFd')
289      d                                     like(xmlOutputBufferPtr)
290      d  fd                           10i 0 value
291      d  encoder                            value
292      d                                     like(xmlCharEncodingHandlerPtr)
293
294      d xmlOutputBufferCreateIO...
295      d                 pr                  extproc('xmlOutputBufferCreateIO')
296      d                                     like(xmlOutputBufferPtr)
297      d  iowrite                            value like(xmlOutputWriteCallback)
298      d  ioclose                            value like(xmlOutputCloseCallback)
299      d  ioctx                          *   value                                void *
300      d  encoder                            value
301      d                                     like(xmlCharEncodingHandlerPtr)
302
303       * Couple of APIs to get the output without digging into the buffers
304
305      d xmlOutputBufferGetContent...
306      d                 pr              *   extproc('xmlOutputBufferGetContent') const xmlChar *
307      d  out                                value like(xmlOutputBufferPtr)
308
309      d xmlOutputBufferGetSize...
310      d                 pr            10u 0 extproc('xmlOutputBufferGetSize')    size_t
311      d  out                                value like(xmlOutputBufferPtr)
312
313      d xmlOutputBufferWrite...
314      d                 pr            10i 0 extproc('xmlOutputBufferWrite')
315      d  out                                value like(xmlOutputBufferPtr)
316      d  len                          10i 0 value
317      d  buf                            *   value options(*string)               const char *
318
319      d xmlOutputBufferWriteString...
320      d                 pr            10i 0 extproc('xmlOutputBufferWriteString')
321      d  out                                value like(xmlOutputBufferPtr)
322      d  str                            *   value options(*string)               const char *
323
324      d xmlOutputBufferWriteEscape...
325      d                 pr            10i 0 extproc('xmlOutputBufferWriteEscape')
326      d  out                                value like(xmlOutputBufferPtr)
327      d  str                            *   value options(*string)               const xmlChar *
328      d  escaping                           value like(xmlCharEncodingOutputFunc)
329
330      d xmlOutputBufferFlush...
331      d                 pr            10i 0 extproc('xmlOutputBufferFlush')
332      d  out                                value like(xmlOutputBufferPtr)
333
334      d xmlOutputBufferClose...
335      d                 pr            10i 0 extproc('xmlOutputBufferClose')
336      d  out                                value like(xmlOutputBufferPtr)
337
338      d xmlRegisterOutputCallbacks...
339      d                 pr            10i 0 extproc('xmlRegisterOutputCallbacks')
340      d  matchFunc                          value like(xmlOutputMatchCallback)
341      d  openFunc                           value like(xmlOutputOpenCallback)
342      d  writeFunc                          value like(xmlOutputWriteCallback)
343      d  closeFunc                          value like(xmlOutputCloseCallback)
344
345       /if defined(LIBXML_HTTP_ENABLED)
346
347       *  This function only exists if HTTP support built into the library
348
349      d xmlRegisterHTTPPostCallbacks...
350      d                 pr                  extproc(
351      d                                      'xmlRegisterHTTPPostCallbacks')
352
353       /endif                                                                    LIBXML_HTTP_ENABLED
354       /endif                                                                    LIBXML_OUTPUT_ENABLD
355
356      d xmlCheckHTTPInput...
357      d                 pr                  extproc('xmlCheckHTTPInput')
358      d                                     like(xmlParserInputPtr)
359      d  ctxt                               value like(xmlParserCtxtPtr)
360      d  ret                                value like(xmlParserInputPtr)
361
362       * A predefined entity loader disabling network accesses
363
364      d xmlNoNetExternalEntityLoader...
365      d                 pr                  extproc(
366      d                                      'xmlNoNetExternalEntityLoader')
367      d                                     like(xmlParserInputPtr)
368      d  URL                            *   value options(*string)               const char *
369      d  ID                             *   value options(*string)               const char *
370      d  ctxt                               value like(xmlParserCtxtPtr)
371
372       * xmlNormalizeWindowsPath is obsolete, don't use it.
373       * Check xmlCanonicPath in uri.h for a better alternative.
374
375      d xmlNormalizeWindowsPath...
376      d                 pr              *   extproc('xmlNormalizeWindowsPath')   xmlChar *
377      d  path                           *   value options(*string)               const xmlChar *
378
379      d xmlCheckFilename...
380      d                 pr            10i 0 extproc('xmlCheckFilename')
381      d  path                           *   value options(*string)               const char *
382
383       * Default 'file://' protocol callbacks
384
385      d xmlFileMatch    pr            10i 0 extproc('xmlFileMatch')
386      d  filename                       *   value options(*string)               const char *
387
388      d xmlFileOpen     pr              *   extproc('xmlFileOpen')               void *
389      d  filename                       *   value options(*string)               const char *
390
391      d xmlFileRead     pr            10i 0 extproc('xmlFileRead')
392      d  context                        *   value                                void *
393      d  buffer                    65535    options(*varsize)
394      d  len                          10i 0 value
395
396      d xmlFileClose    pr            10i 0 extproc('xmlFileClose')
397      d  context                        *   value                                void *
398
399       * Default 'http://' protocol callbacks
400
401       /if defined(LIBXML_HTTP_ENABLED)
402      d xmlIOHTTPMatch  pr            10i 0 extproc('xmlIOHTTPMatch')
403      d  filename                       *   value options(*string)               const char *
404
405      d xmlIOHTTPOpen   pr              *   extproc('xmlIOHTTPOpen')             void *
406      d  filename                       *   value options(*string)               const char *
407
408       /if defined(LIBXML_OUTPUT_ENABLED)
409      d xmlIOHTTPOpenW  pr              *   extproc('xmlIOHTTPOpenW')            void *
410      d  post_uri                       *   value options(*string)               const char *
411      d  compression                  10i 0 value
412       /endif                                                                    LIBXML_OUTPUT_ENABLD
413
414      d xmlIOHTTPRead   pr            10i 0 extproc('xmlIOHTTPRead')
415      d  context                        *   value                                void *
416      d  buffer                    65535    options(*varsize)
417      d  len                          10i 0 value
418
419      d xmlIOHTTPClose  pr            10i 0 extproc('xmlIOHTTPClose')
420      d  context                        *   value                                void *
421       /endif                                                                    LIBXML_HTTP_ENABLED
422
423       * Default 'ftp://' protocol callbacks
424
425       /if defined(LIBXML_FTP_ENABLED)
426      d xmlIOFTPMatch   pr            10i 0 extproc('xmlIOFTPMatch')
427      d  filename                       *   value options(*string)               const char *
428
429      d xmlIOFTPOpen    pr              *   extproc('xmlIOFTPOpen')              void *
430      d  filename                       *   value options(*string)               const char *
431
432      d xmlIOFTPRead    pr            10i 0 extproc('xmlIOFTPRead')
433      d  context                        *   value                                void *
434      d  buffer                    65535    options(*varsize)
435      d  len                          10i 0 value
436
437      d xmlIOFTPClose   pr            10i 0 extproc('xmlIOFTPClose')
438      d  context                        *   value                                void *
439       /endif                                                                    LIBXML_FTP_ENABLED
440
441       /endif                                                                    XML_IO_H__