xcap_functions.h

Go to the documentation of this file.
00001 /*
00002  * $Id: xcap_functions.h 2230 2007-06-06 07:13:20Z anca_vamanu $
00003  *
00004  * xcap_client module - XCAP client for openser
00005  *
00006  * Copyright (C) 2007 Voice Sistem S.R.L.
00007  *
00008  * This file is part of Kamailio, a free SIP server.
00009  *
00010  * Kamailio is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version
00014  *
00015  * Kamailio is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License 
00021  * along with this program; if not, write to the Free Software 
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  * History:
00025  * --------
00026  *  2007-08-20  initial version (anca)
00027  */
00028 
00029 #ifndef XCAP_FUNC_H
00030 #define XCAP_FUNC_H
00031 
00032 #include "xcap_callbacks.h"
00033 
00034 #define USERS_TYPE      1
00035 #define GLOBAL_TYPE     2
00036 
00037 #define IF_MATCH     1
00038 #define IF_NONE_MATCH    2
00039 
00040 /* macros for the entities responsible for handling a record inserted
00041  * in xcap table*/
00042 
00043 #define INTEGRATED_SERVER      0
00044 #define XCAP_CL_MOD            1 /* xcap_client module responsibility */
00045 
00046 
00047 typedef struct xcap_doc_sel
00048 {
00049    str auid;
00050    int doc_type;
00051    int type; 
00052    str xid;
00053    str filename;
00054 }xcap_doc_sel_t;
00055 
00056 typedef struct ns_list
00057 {
00058    int name;
00059    str value;
00060    struct ns_list* next;
00061 }ns_list_t;
00062 
00063 typedef struct step
00064 {
00065    str val;
00066    struct step* next;
00067 }step_t;
00068 
00069 typedef struct xcap_node_sel
00070 {
00071    step_t* steps;
00072    step_t* last_step;
00073    int size;
00074    ns_list_t* ns_list;
00075    ns_list_t* last_ns;
00076    int ns_no;
00077 
00078 }xcap_node_sel_t;
00079 
00080 typedef struct att_test
00081 {
00082    str name;
00083    str value;
00084 }attr_test_t;
00085 
00086 typedef struct xcap_get_req
00087 {
00088    char* xcap_root;
00089    unsigned int port;
00090    xcap_doc_sel_t doc_sel;
00091    xcap_node_sel_t* node_sel;
00092    char* etag;
00093    int match_type;
00094 }xcap_get_req_t;
00095 
00096 xcap_node_sel_t* xcapInitNodeSel(void);
00097 typedef xcap_node_sel_t* (*xcap_nodeSel_init_t )(void);
00098 
00099 xcap_node_sel_t* xcapNodeSelAddStep(xcap_node_sel_t* curr_sel, str* name,
00100       str* namespace, int pos, attr_test_t*  attr_test, str* extra_sel);
00101 
00102 typedef xcap_node_sel_t* (*xcap_nodeSel_add_step_t)(xcap_node_sel_t* curr_sel,
00103    str* name,str* namespace,int pos,attr_test_t*  attr_test,str* extra_sel);
00104 
00105 xcap_node_sel_t* xcapNodeSelAddTerminal(xcap_node_sel_t* curr_sel, 
00106       char* attr_sel, char* namespace_sel, char* extra_sel );
00107 
00108 typedef xcap_node_sel_t* (*xcap_nodeSel_add_terminal_t)(xcap_node_sel_t* curr_sel, 
00109       char* attr_sel, char* namespace_sel, char* extra_sel );
00110 
00111 /* generical function to get an element from an xcap server */
00112 char* xcapGetElem(xcap_get_req_t req, char** etag);
00113 
00114 typedef char* (*xcap_get_elem_t)(xcap_get_req_t req, char** etag);
00115 
00116 void xcapFreeNodeSel(xcap_node_sel_t* node);
00117 
00118 typedef void (*xcap_nodeSel_free_t)(xcap_node_sel_t* node);
00119 
00120 /* specifical function to get a new document, not present in xcap table 
00121  * to be updated and handled by the xcap_client module*/
00122 char* xcapGetNewDoc(xcap_get_req_t req, str user, str domain);
00123 typedef char* (*xcapGetNewDoc_t)(xcap_get_req_t req, str user, str domain);
00124 
00125 typedef struct xcap_api {
00126    xcap_get_elem_t get_elem;
00127    xcap_nodeSel_init_t int_node_sel;
00128    xcap_nodeSel_add_step_t add_step;
00129    xcap_nodeSel_add_terminal_t add_terminal;
00130    xcap_nodeSel_free_t free_node_sel;
00131    xcapGetNewDoc_t getNewDoc;
00132    register_xcapcb_t register_xcb;
00133 }xcap_api_t;
00134 
00135 int bind_xcap(xcap_api_t* api);
00136 
00137 typedef int (*bind_xcap_t)(xcap_api_t* api);
00138 
00139 char* send_http_get(char* path, unsigned int xcap_port, char* match_etag,
00140       int match_type, char** etag);
00141 #endif

Generated on Fri May 25 00:00:35 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6