createrepo_c library 1.2.1 C library for metadata manipulation

xml_parser.h
1 /* createrepo_c - Library of routines for manipulation with repodata
2 * Copyright (C) 2013 Tomas Mlcoch
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17 * USA.
18 */
19
20 #ifndef __C_CREATEREPOLIB_XML_PARSER_H__
21 #define __C_CREATEREPOLIB_XML_PARSER_H__
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #include <glib.h>
28 #include "package.h"
29 #include "repomd.h"
30 #include "updateinfo.h"
31
37 #define CR_CB_RET_OK 0
38 #define CR_CB_RET_ERR 1
42 typedef enum {
43 CR_XML_WARNING_UNKNOWNTAG,
44 CR_XML_WARNING_MISSINGATTR,
45 CR_XML_WARNING_UNKNOWNVAL,
46 CR_XML_WARNING_BADATTRVAL,
47 CR_XML_WARNING_MISSINGVAL,
48 CR_XML_WARNING_BADMDTYPE,
49 CR_XML_WARNING_SENTINEL,
50 } cr_XmlParserWarningType;
51
68 typedef int (*cr_XmlParserNewPkgCb)(cr_Package **pkg,
69 const char *pkgId,
70 const char *name,
71 const char *arch,
72 void *cbdata,
73 GError **err);
74
81 typedef int (*cr_XmlParserPkgCb)(cr_Package *pkg,
82 void *cbdata,
83 GError **err);
84
95 typedef int (*cr_XmlParserWarningCb)(cr_XmlParserWarningType type,
96 char *msg,
97 void *cbdata,
98 GError **err);
99
116 int cr_xml_parse_primary(const char *path,
117 cr_XmlParserNewPkgCb newpkgcb,
118 void *newpkgcb_data,
119 cr_XmlParserPkgCb pkgcb,
120 void *pkgcb_data,
121 cr_XmlParserWarningCb warningcb,
122 void *warningcb_data,
123 int do_files,
124 GError **err);
125
143 int cr_xml_parse_primary_snippet(const char *xml_string,
144 cr_XmlParserNewPkgCb newpkgcb,
145 void *newpkgcb_data,
146 cr_XmlParserPkgCb pkgcb,
147 void *pkgcb_data,
148 cr_XmlParserWarningCb warningcb,
149 void *warningcb_data,
150 int do_files,
151 GError **err);
152
168 int cr_xml_parse_filelists(const char *path,
169 cr_XmlParserNewPkgCb newpkgcb,
170 void *newpkgcb_data,
171 cr_XmlParserPkgCb pkgcb,
172 void *pkgcb_data,
173 cr_XmlParserWarningCb warningcb,
174 void *warningcb_data,
175 GError **err);
176
193 int cr_xml_parse_filelists_snippet(const char *xml_string,
194 cr_XmlParserNewPkgCb newpkgcb,
195 void *newpkgcb_data,
196 cr_XmlParserPkgCb pkgcb,
197 void *pkgcb_data,
198 cr_XmlParserWarningCb warningcb,
199 void *warningcb_data,
200 GError **err);
201
217 int cr_xml_parse_other(const char *path,
218 cr_XmlParserNewPkgCb newpkgcb,
219 void *newpkgcb_data,
220 cr_XmlParserPkgCb pkgcb,
221 void *pkgcb_data,
222 cr_XmlParserWarningCb warningcb,
223 void *warningcb_data,
224 GError **err);
225
242 int cr_xml_parse_other_snippet(const char *xml_string,
243 cr_XmlParserNewPkgCb newpkgcb,
244 void *newpkgcb_data,
245 cr_XmlParserPkgCb pkgcb,
246 void *pkgcb_data,
247 cr_XmlParserWarningCb warningcb,
248 void *warningcb_data,
249 GError **err);
250
259 int
260 cr_xml_parse_repomd(const char *path,
261 cr_Repomd *repomd,
262 cr_XmlParserWarningCb warningcb,
263 void *warningcb_data,
264 GError **err);
265
274 int
275 cr_xml_parse_updateinfo(const char *path,
276 cr_UpdateInfo *updateinfo,
277 cr_XmlParserWarningCb warningcb,
278 void *warningcb_data,
279 GError **err);
280
281 typedef struct _cr_PkgIterator cr_PkgIterator;
282
283 cr_PkgIterator *
284 cr_PkgIterator_new(const char *primary_path,
285 const char *filelists_path,
286 const char *other_path,
287 cr_XmlParserNewPkgCb newpkgcb,
288 void *newpkgcb_data,
289 cr_XmlParserWarningCb warningcb,
290 void *warningcb_data,
291 GError **err);
292 cr_Package* cr_PkgIterator_parse_next(cr_PkgIterator *iter, GError **err);
293 void cr_PkgIterator_free(cr_PkgIterator *iter, GError **err);
294 gboolean cr_PkgIterator_is_finished(cr_PkgIterator *iter);
295
298 #ifdef __cplusplus
299 }
300 #endif
301
302 #endif /* __C_CREATEREPOLIB_XML_PARSER_H__ */
cr_xml_parse_other
int cr_xml_parse_other(const char *path, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err)
CR_XML_WARNING_MISSINGVAL
@ CR_XML_WARNING_MISSINGVAL
Definition: xml_parser.h:47
CR_XML_WARNING_BADATTRVAL
@ CR_XML_WARNING_BADATTRVAL
Definition: xml_parser.h:46
cr_UpdateInfo
Definition: updateinfo.h:105
cr_xml_parse_other_snippet
int cr_xml_parse_other_snippet(const char *xml_string, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err)
cr_xml_parse_filelists_snippet
int cr_xml_parse_filelists_snippet(const char *xml_string, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err)
cr_xml_parse_primary_snippet
int cr_xml_parse_primary_snippet(const char *xml_string, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, int do_files, GError **err)
cr_xml_parse_repomd
int cr_xml_parse_repomd(const char *path, cr_Repomd *repomd, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err)
cr_Repomd
Definition: repomd.h:103
cr_xml_parse_filelists
int cr_xml_parse_filelists(const char *path, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err)
CR_XML_WARNING_UNKNOWNTAG
@ CR_XML_WARNING_UNKNOWNTAG
Definition: xml_parser.h:43
cr_XmlParserNewPkgCb
int(* cr_XmlParserNewPkgCb)(cr_Package **pkg, const char *pkgId, const char *name, const char *arch, void *cbdata, GError **err)
Definition: xml_parser.h:68
cr_XmlParserWarningType
cr_XmlParserWarningType
Definition: xml_parser.h:42
CR_XML_WARNING_UNKNOWNVAL
@ CR_XML_WARNING_UNKNOWNVAL
Definition: xml_parser.h:45
cr_xml_parse_primary
int cr_xml_parse_primary(const char *path, cr_XmlParserNewPkgCb newpkgcb, void *newpkgcb_data, cr_XmlParserPkgCb pkgcb, void *pkgcb_data, cr_XmlParserWarningCb warningcb, void *warningcb_data, int do_files, GError **err)
cr_xml_parse_updateinfo
int cr_xml_parse_updateinfo(const char *path, cr_UpdateInfo *updateinfo, cr_XmlParserWarningCb warningcb, void *warningcb_data, GError **err)
cr_XmlParserPkgCb
int(* cr_XmlParserPkgCb)(cr_Package *pkg, void *cbdata, GError **err)
Definition: xml_parser.h:81
cr_XmlParserWarningCb
int(* cr_XmlParserWarningCb)(cr_XmlParserWarningType type, char *msg, void *cbdata, GError **err)
Definition: xml_parser.h:95
CR_XML_WARNING_BADMDTYPE
@ CR_XML_WARNING_BADMDTYPE
Definition: xml_parser.h:48
CR_XML_WARNING_MISSINGATTR
@ CR_XML_WARNING_MISSINGATTR
Definition: xml_parser.h:44
cr_Package
Definition: package.h:84