OpenVAS Libraries  4.0+rc3.SVN
omp/xml.h
00001 /* openvase-libraries/omp/xml
00002  * $Id$
00003  * Description: Headers for simple XML reader.
00004  *
00005  * Authors:
00006  * Matthew Mundell <matt@mundell.ukfsn.org>
00007  *
00008  * Copyright:
00009  * Copyright (C) 2009 Greenbone Networks GmbH
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License version 2,
00013  * or, at your option, any later version as published by the Free
00014  * Software Foundation
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
00024  */
00025 
00026 #ifndef _OPENVAS_LIBRARIES_XML_H
00027 #define _OPENVAS_LIBRARIES_XML_H
00028 
00029 #include <glib.h>
00030 #include <gnutls/gnutls.h>
00031 #include <stdio.h>
00032 
00033 #ifdef __cplusplus
00034 extern "C"
00035 {
00036 #if 0
00037 }
00038 #endif
00039 #endif
00040 
00041 typedef GSList *entities_t;
00042 
00046 struct entity_s
00047 {
00048   char *name;                   
00049   char *text;                   
00050   GHashTable *attributes;       
00051   entities_t entities;          
00052 };
00053 typedef struct entity_s *entity_t;
00054 
00055 entities_t next_entities (entities_t);
00056 
00057 entity_t first_entity (entities_t);
00058 
00059 entity_t add_entity (entities_t *, const char *, const char *);
00060 
00061 void add_attribute (entity_t, const char *, const char *);
00062 
00063 int compare_entities (entity_t, entity_t);
00064 
00065 entity_t entity_child (entity_t, const char *);
00066 
00067 const char *entity_attribute (entity_t, const char *);
00068 
00069 char *entity_name (entity_t entity);
00070 
00071 char *entity_text (entity_t entity);
00072 
00073 void free_entity (entity_t);
00074 
00075 void print_entity (FILE *, entity_t);
00076 
00077 void print_entities (FILE *, entities_t);
00078 
00079 void print_entity_format (entity_t, gpointer indentation);
00080 
00081 void print_entities_format (entities_t, int indentation);
00082 
00083 int try_read_entity_and_string (gnutls_session_t *, int, entity_t *,
00084                                 GString **);
00085 
00086 int read_entity_and_string (gnutls_session_t *, entity_t *, GString **);
00087 
00088 int read_entity_and_text (gnutls_session_t *, entity_t *, char **);
00089 
00090 int try_read_entity (gnutls_session_t *, int, entity_t *);
00091 
00092 int read_entity (gnutls_session_t *, entity_t *);
00093 
00094 int read_string (gnutls_session_t *, GString **);
00095 
00096 int parse_entity (const char *, entity_t *);
00097 
00098 void print_entity_to_string (entity_t entity, GString * string);
00099 
00100 void print_entities_to_string (GString * string, entities_t entities);
00101 
00102 int xml_count_entities (entities_t);
00103 
00104 #if 0
00105 {
00106 #endif
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 #endif /* not _OPENVAS_LIBRARIES_XML_H */