lib/xcap/xcap_client.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 __XCAP_CLIENT_H
00027 #define __XCAP_CLIENT_H
00028 
00029 #include <cds/sstr.h>
00030 #include <xcap/xcap_result_codes.h>
00031 
00032 typedef struct {
00033         /* "prefix" for XCAP query */
00034         str_t xcap_root;
00036         str_t auth_user;
00038         str_t auth_pass;
00042         int enable_unverified_ssl_peer;
00043 } xcap_query_params_t;
00044 
00045 typedef enum {
00046         xcap_doc_pres_rules,
00047         xcap_doc_im_rules,
00048         xcap_doc_rls_services,
00049         xcap_doc_resource_lists
00050 } xcap_document_type_t;
00051 
00052 char *xcap_uri_for_users_document(xcap_document_type_t doc_type,
00053                 const str_t *username, 
00054                 const str_t*filename,
00055                 xcap_query_params_t *params);
00056 
00057 char *xcap_uri_for_global_document(xcap_document_type_t doc_type,
00058                 const str_t *filename,
00059                 xcap_query_params_t *params);
00060 
00064 /* URI is absolute HTTP/HTTPS uri for the query  */
00065 int xcap_query(const char *uri, xcap_query_params_t *params, 
00066                 char **buf, int *bsize);
00067 
00068 typedef int (*xcap_query_func)(const char *uri, 
00069                 xcap_query_params_t *params, 
00070                 char **buf, int *bsize);
00071 
00072 void free_xcap_params_content(xcap_query_params_t *params);
00073 int dup_xcap_params(xcap_query_params_t *dst, xcap_query_params_t *src);
00074 
00075 /* counts the length for data buffer storing values of
00076  * xcap parameter members */
00077 int get_inline_xcap_buf_len(xcap_query_params_t *params);
00078 
00079 /* copies structure into existing buffer */
00080 int dup_xcap_params_inline(xcap_query_params_t *dst, xcap_query_params_t *src, char *data_buffer);
00081 
00082 int str2xcap_params(xcap_query_params_t *dst, const str_t *src);
00083 int xcap_params2str(str_t *dst, xcap_query_params_t *src);
00084 
00085 #endif