xpidf.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  3. * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __PJSIP_SIMPLE_XPIDF_H__
  20. #define __PJSIP_SIMPLE_XPIDF_H__
  21. /**
  22. * @file xpidf.h
  23. * @brief XPIDF/Presence Information Data Format
  24. */
  25. #include <pjsip-simple/types.h>
  26. #include <pjlib-util/xml.h>
  27. PJ_BEGIN_DECL
  28. /**
  29. * @defgroup PJSIP_SIMPLE_XPIDF XPIDF/Presence Information Data Format
  30. * @ingroup PJSIP_SIMPLE
  31. * @brief Support for XPIDF/Presence Information Data Format
  32. * @{
  33. *
  34. * This is an old presence data format as described in:
  35. * draft-rosenberg-impp-pidf-00.txt.
  36. *
  37. * We won't support this format extensively here, as it seems there's not
  38. * too many implementations support this anymore, as it shouldn't.
  39. */
  40. /** Type definitions for XPIDF root document. */
  41. typedef pj_xml_node pjxpidf_pres;
  42. /**
  43. * Create a new XPIDF document.
  44. *
  45. * @param pool Pool.
  46. * @param uri URI to set in the XPIDF document.
  47. *
  48. * @return XPIDF document.
  49. */
  50. PJ_DECL(pjxpidf_pres*) pjxpidf_create(pj_pool_t *pool, const pj_str_t *uri);
  51. /**
  52. * Parse XPIDF document.
  53. *
  54. * Note that the input text buffer MUST be NULL terminated and have
  55. * length at least len+1 (len MUST NOT include the NULL terminator).
  56. *
  57. * @param pool Pool.
  58. * @param text Input text, MUST be NULL terminated.
  59. * @param len Length of input text, NOT including the NULL terminator.
  60. *
  61. * @return XPIDF document.
  62. */
  63. PJ_DECL(pjxpidf_pres*) pjxpidf_parse(pj_pool_t *pool, char *text, pj_size_t len);
  64. /**
  65. * Print XPIDF document.
  66. *
  67. * @param pres The XPIDF document to print.
  68. * @param text Buffer to place the output.
  69. * @param len Length of the buffer.
  70. *
  71. * @return The length printed.
  72. */
  73. PJ_DECL(int) pjxpidf_print( pjxpidf_pres *pres, char *text, pj_size_t len);
  74. /**
  75. * Get URI in the XPIDF document
  76. *
  77. * @param pres XPIDF document
  78. *
  79. * @return The URI, or an empty string.
  80. */
  81. PJ_DECL(pj_str_t*) pjxpidf_get_uri(pjxpidf_pres *pres);
  82. /**
  83. * Set the URI of the XPIDF document.
  84. *
  85. * @param pool Pool.
  86. * @param pres The XPIDF document.
  87. * @param uri URI to set in the XPIDF document.
  88. *
  89. * @return Zero on success.
  90. */
  91. PJ_DECL(pj_status_t) pjxpidf_set_uri(pj_pool_t *pool, pjxpidf_pres *pres,
  92. const pj_str_t *uri);
  93. /**
  94. * Get presence status in the XPIDF document.
  95. *
  96. * @param pres XPIDF document.
  97. *
  98. * @return True to indicate the contact is online.
  99. */
  100. PJ_DECL(pj_bool_t) pjxpidf_get_status(pjxpidf_pres *pres);
  101. /**
  102. * Set presence status in the XPIDF document.
  103. *
  104. * @param pres XPIDF document.
  105. * @param status Status to set, True for online, False for offline.
  106. *
  107. * @return Zero on success.
  108. */
  109. PJ_DECL(pj_status_t) pjxpidf_set_status(pjxpidf_pres *pres, pj_bool_t status);
  110. /**
  111. * @}
  112. */
  113. PJ_END_DECL
  114. #endif /* __PJSIP_SIMPLE_XPIDF_H__ */