xcap_functions.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * $Id: xcap_functions.h 2230 2007-06-06 07:13:20Z anca_vamanu $
  3. *
  4. * xcap_client module - XCAP client for Kamailio
  5. *
  6. * Copyright (C) 2007 Voice Sistem S.R.L.
  7. *
  8. * This file is part of Kamailio, a free SIP server.
  9. *
  10. * Kamailio is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version
  14. *
  15. * Kamailio is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * History:
  25. * --------
  26. * 2007-08-20 initial version (anca)
  27. */
  28. #ifndef XCAP_FUNC_H
  29. #define XCAP_FUNC_H
  30. #include "xcap_callbacks.h"
  31. #define USERS_TYPE 1
  32. #define GLOBAL_TYPE 2
  33. #define IF_MATCH 1
  34. #define IF_NONE_MATCH 2
  35. /* macros for the entities responsible for handling a record inserted
  36. * in xcap table*/
  37. #define INTEGRATED_SERVER 0
  38. #define XCAP_CL_MOD 1 /* xcap_client module responsibility */
  39. typedef struct xcap_doc_sel
  40. {
  41. str auid;
  42. int doc_type;
  43. int type;
  44. str xid;
  45. str filename;
  46. }xcap_doc_sel_t;
  47. typedef struct ns_list
  48. {
  49. int name;
  50. str value;
  51. struct ns_list* next;
  52. }ns_list_t;
  53. typedef struct step
  54. {
  55. str val;
  56. struct step* next;
  57. }step_t;
  58. typedef struct xcap_node_sel
  59. {
  60. step_t* steps;
  61. step_t* last_step;
  62. int size;
  63. ns_list_t* ns_list;
  64. ns_list_t* last_ns;
  65. int ns_no;
  66. }xcap_node_sel_t;
  67. typedef struct att_test
  68. {
  69. str name;
  70. str value;
  71. }attr_test_t;
  72. typedef struct xcap_get_req
  73. {
  74. char* xcap_root;
  75. unsigned int port;
  76. xcap_doc_sel_t doc_sel;
  77. xcap_node_sel_t* node_sel;
  78. char* etag;
  79. int match_type;
  80. }xcap_get_req_t;
  81. xcap_node_sel_t* xcapInitNodeSel(void);
  82. typedef xcap_node_sel_t* (*xcap_nodeSel_init_t )(void);
  83. xcap_node_sel_t* xcapNodeSelAddStep(xcap_node_sel_t* curr_sel, str* name,
  84. str* namespace, int pos, attr_test_t* attr_test, str* extra_sel);
  85. typedef xcap_node_sel_t* (*xcap_nodeSel_add_step_t)(xcap_node_sel_t* curr_sel,
  86. str* name,str* namespace,int pos,attr_test_t* attr_test,str* extra_sel);
  87. xcap_node_sel_t* xcapNodeSelAddTerminal(xcap_node_sel_t* curr_sel,
  88. char* attr_sel, char* namespace_sel, char* extra_sel );
  89. typedef xcap_node_sel_t* (*xcap_nodeSel_add_terminal_t)(xcap_node_sel_t* curr_sel,
  90. char* attr_sel, char* namespace_sel, char* extra_sel );
  91. /* generical function to get an element from an xcap server */
  92. char* xcapGetElem(xcap_get_req_t req, char** etag);
  93. typedef char* (*xcap_get_elem_t)(xcap_get_req_t req, char** etag);
  94. void xcapFreeNodeSel(xcap_node_sel_t* node);
  95. typedef void (*xcap_nodeSel_free_t)(xcap_node_sel_t* node);
  96. /* specifical function to get a new document, not present in xcap table
  97. * to be updated and handled by the xcap_client module*/
  98. char* xcapGetNewDoc(xcap_get_req_t req, str user, str domain);
  99. typedef char* (*xcapGetNewDoc_t)(xcap_get_req_t req, str user, str domain);
  100. typedef struct xcap_api {
  101. xcap_get_elem_t get_elem;
  102. xcap_nodeSel_init_t int_node_sel;
  103. xcap_nodeSel_add_step_t add_step;
  104. xcap_nodeSel_add_terminal_t add_terminal;
  105. xcap_nodeSel_free_t free_node_sel;
  106. xcapGetNewDoc_t getNewDoc;
  107. register_xcapcb_t register_xcb;
  108. }xcap_api_t;
  109. int bind_xcap(xcap_api_t* api);
  110. typedef int (*bind_xcap_t)(xcap_api_t* api);
  111. char* send_http_get(char* path, unsigned int xcap_port, char* match_etag,
  112. int match_type, char** etag);
  113. #endif