Crashing in RSS code probably fixed. Memory leak in prss fixed.
[monky] / src / prss.h
1 /*
2  * Copyright (c) 2007 Mikko Sysikaski <mikko.sysikaski@gmail.com>
3  *                    Toni Spets <toni.spets@gmail.com>
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17
18 #ifndef PRSS_H
19 #define PRSS_H
20
21 #include <libxml/parser.h>
22
23 typedef struct PRSS_Item_ {
24         char* title;
25         char* link;
26         char* description;
27         char* category;
28         char* pubdate;
29         char* guid;
30 } PRSS_Item;
31
32 typedef struct PRSS_ {
33         xmlDocPtr _data;
34         
35         char* title;
36         char* link;
37         char* description;
38         char* language;
39         char* generator;
40         char* managingeditor;
41         char* webmaster;
42         char* docs;
43         char* lastbuilddate;
44         char* pubdate;
45
46         PRSS_Item* items;
47         int item_count;
48 } PRSS;
49
50 /* Functions for parsing RSS-data */
51 PRSS* prss_parse_data(const char *xml_data);
52 PRSS* prss_parse_file(const char *xml_file);
53
54 // Works wrong currently when called from application!
55 //PRSS* prss_parse_doc(xmlDocPtr doc);
56
57 /* Frees the PRSS-stucture returned by prss_parse_*.
58  * The memory area pointed by data becomes invalid
59  * after call to this function. */
60 void prss_free(PRSS* data);
61
62 #endif  // PRSS_H