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