xcap_client.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (C) 2005 iptelorg GmbH
  3. *
  4. * This file is part of ser, a free SIP server.
  5. *
  6. * ser is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version
  10. *
  11. * For a license to use the ser software under conditions
  12. * other than those described here, or to purchase support for this
  13. * software, please contact iptel.org by e-mail at the following addresses:
  14. * [email protected]
  15. *
  16. * ser is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. */
  25. #ifndef __XCAP_CLIENT_H
  26. #define __XCAP_CLIENT_H
  27. #include <cds/sstr.h>
  28. #include <xcap/xcap_result_codes.h>
  29. typedef struct {
  30. /* "prefix" for XCAP query */
  31. str_t xcap_root;
  32. /** username for authentication */
  33. str_t auth_user;
  34. /** password used for authentication */
  35. str_t auth_pass;
  36. /** Accept unverifiable peers (ignore information
  37. * stored in certificate and trust a certificate
  38. * without know CA). */
  39. int enable_unverified_ssl_peer;
  40. } xcap_query_params_t;
  41. typedef enum {
  42. xcap_doc_pres_rules,
  43. xcap_doc_im_rules,
  44. xcap_doc_rls_services,
  45. xcap_doc_resource_lists
  46. } xcap_document_type_t;
  47. char *xcap_uri_for_users_document(xcap_document_type_t doc_type,
  48. const str_t *username,
  49. const str_t*filename,
  50. xcap_query_params_t *params);
  51. char *xcap_uri_for_global_document(xcap_document_type_t doc_type,
  52. const str_t *filename,
  53. xcap_query_params_t *params);
  54. /** Sends a XCAP query to the destination and using parameters from
  55. * query variable a returns received data in output variables buf
  56. * and bsize. */
  57. /* URI is absolute HTTP/HTTPS uri for the query */
  58. int xcap_query(const char *uri, xcap_query_params_t *params,
  59. char **buf, int *bsize);
  60. typedef int (*xcap_query_func)(const char *uri,
  61. xcap_query_params_t *params,
  62. char **buf, int *bsize);
  63. void free_xcap_params_content(xcap_query_params_t *params);
  64. int dup_xcap_params(xcap_query_params_t *dst, xcap_query_params_t *src);
  65. /* counts the length for data buffer storing values of
  66. * xcap parameter members */
  67. int get_inline_xcap_buf_len(xcap_query_params_t *params);
  68. /* copies structure into existing buffer */
  69. int dup_xcap_params_inline(xcap_query_params_t *dst, xcap_query_params_t *src, char *data_buffer);
  70. int str2xcap_params(xcap_query_params_t *dst, const str_t *src);
  71. int xcap_params2str(str_t *dst, xcap_query_params_t *src);
  72. #endif