rls_services_parser.h

00001 /* 
00002  * Copyright (C) 2005 iptelorg GmbH
00003  *
00004  * This file is part of ser, a free SIP server.
00005  *
00006  * ser is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version
00010  *
00011  * For a license to use the ser software under conditions
00012  * other than those described here, or to purchase support for this
00013  * software, please contact iptel.org by e-mail at the following addresses:
00014  *    info@iptel.org
00015  *
00016  * ser 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  */
00025 
00026 #ifndef __RLS_SERVICES_PARSER_PARSER_H
00027 #define __RLS_SERVICES_PARSER_PARSER_H
00028 
00029 #include <xcap/xml_utils.h>
00030 #include <xcap/resource_lists_parser.h>
00031 
00032 typedef struct _package_t {
00033         SEQUENCE_ABLE(struct _package_t)
00034         char *name;
00035 } package_t;
00036 
00037 typedef struct _packages_t {
00038         SEQUENCE(package_t) package;
00039 } packages_t;
00040 
00041 typedef enum { 
00042         stc_list,
00043         stc_resource_list,
00044 } service_content_type_t;
00045 
00046 typedef struct _service_t {
00047         SEQUENCE_ABLE(struct _service_t)
00048                 
00049         packages_t *packages;
00050         
00051         service_content_type_t content_type;
00052         union {
00053                 list_t *list;
00054                 char *resource_list; /* uri */
00055         } content;
00056         
00057         char *uri;
00058 } service_t;
00059 
00060 typedef struct {
00061         SEQUENCE(service_t) rls_services;
00062 } rls_services_t;
00063 
00064 int parse_rls_services_xml(const char *data, int data_len, rls_services_t **dst);
00065 int parse_service(const char *data, int data_len, service_t **dst);
00066 void free_rls_services(rls_services_t *rl);
00067 void free_service(service_t *s);
00068 int read_service(xmlNode *list_node, service_t **dst);
00069 
00070 #endif