OpenVAS Libraries  4.0+rc3.SVN
xml.h
1 /* openvase-libraries/omp/xml
2  * $Id$
3  * Description: Headers for simple XML reader.
4  *
5  * Authors:
6  * Matthew Mundell <matt@mundell.ukfsn.org>
7  *
8  * Copyright:
9  * Copyright (C) 2009 Greenbone Networks GmbH
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License version 2,
13  * or, at your option, any later version as published by the Free
14  * Software Foundation
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25 
26 #ifndef _OPENVAS_LIBRARIES_XML_H
27 #define _OPENVAS_LIBRARIES_XML_H
28 
29 #include <glib.h>
30 #include <gnutls/gnutls.h>
31 #include <stdio.h>
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #if 0
37 }
38 #endif
39 #endif
40 
41 typedef GSList *entities_t;
42 
46 struct entity_s
47 {
48  char *name;
49  char *text;
50  GHashTable *attributes;
51  entities_t entities;
52 };
53 typedef struct entity_s *entity_t;
54 
55 entities_t next_entities (entities_t);
56 
57 entity_t first_entity (entities_t);
58 
59 entity_t add_entity (entities_t *, const char *, const char *);
60 
61 void add_attribute (entity_t, const char *, const char *);
62 
63 int compare_entities (entity_t, entity_t);
64 
65 entity_t entity_child (entity_t, const char *);
66 
67 const char *entity_attribute (entity_t, const char *);
68 
69 char *entity_name (entity_t entity);
70 
71 char *entity_text (entity_t entity);
72 
73 void free_entity (entity_t);
74 
75 void print_entity (FILE *, entity_t);
76 
77 void print_entities (FILE *, entities_t);
78 
79 void print_entity_format (entity_t, gpointer indentation);
80 
81 void print_entities_format (entities_t, int indentation);
82 
83 int try_read_entity_and_string (gnutls_session_t *, int, entity_t *,
84  GString **);
85 
86 int read_entity_and_string (gnutls_session_t *, entity_t *, GString **);
87 
88 int read_entity_and_text (gnutls_session_t *, entity_t *, char **);
89 
90 int try_read_entity (gnutls_session_t *, int, entity_t *);
91 
92 int read_entity (gnutls_session_t *, entity_t *);
93 
94 int read_string (gnutls_session_t *, GString **);
95 
96 int parse_entity (const char *, entity_t *);
97 
98 void print_entity_to_string (entity_t entity, GString * string);
99 
100 void print_entities_to_string (GString * string, entities_t entities);
101 
102 int xml_count_entities (entities_t);
103 
104 #if 0
105 {
106 #endif
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif /* not _OPENVAS_LIBRARIES_XML_H */