rpid.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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_RPID_H__
  20. #define __PJSIP_SIMPLE_RPID_H__
  21. /**
  22. * @file rpid.h
  23. * @brief RPID: Rich Presence Extensions to the PIDF (RFC 4480)
  24. */
  25. #include <pjsip-simple/types.h>
  26. #include <pjsip-simple/pidf.h>
  27. PJ_BEGIN_DECL
  28. /**
  29. * @defgroup PJSIP_SIMPLE_RPID RPID/Rich Presence Extensions to PIDF (RFC 4480)
  30. * @ingroup PJSIP_SIMPLE
  31. * @brief RPID/Rich Presence Extensions to PIDF (RFC 4480)
  32. * @{
  33. *
  34. * This file provides tools for managing subset of RPID elements into
  35. * PIDF document.
  36. */
  37. /**
  38. * This enumeration describes subset of standard activities as
  39. * described by RFC 4480, RPID: Rich Presence Extensions to the
  40. * Presence Information Data Format (PIDF).
  41. */
  42. typedef enum pjrpid_activity
  43. {
  44. /** Activity is unknown. The activity would then be conceived
  45. * in the "note" field.
  46. */
  47. PJRPID_ACTIVITY_UNKNOWN,
  48. /** The person is away */
  49. PJRPID_ACTIVITY_AWAY,
  50. /** The person is busy */
  51. PJRPID_ACTIVITY_BUSY
  52. } pjrpid_activity;
  53. /**
  54. * This enumeration describes types of RPID element.
  55. */
  56. typedef enum pjrpid_element_type
  57. {
  58. /** RPID <person> element */
  59. PJRPID_ELEMENT_TYPE_PERSON
  60. } pjrpid_element_type;
  61. /**
  62. * This structure describes person information in RPID document.
  63. */
  64. typedef struct pjrpid_element
  65. {
  66. /** Element type. */
  67. pjrpid_element_type type;
  68. /** Optional id to set on the element. */
  69. pj_str_t id;
  70. /** Activity type. */
  71. pjrpid_activity activity;
  72. /** Optional text describing the person/element. */
  73. pj_str_t note;
  74. } pjrpid_element;
  75. /**
  76. * Duplicate RPID element.
  77. *
  78. * @param pool Pool.
  79. * @param dst Destination structure.
  80. * @param src Source structure.
  81. */
  82. PJ_DECL(void) pjrpid_element_dup(pj_pool_t *pool, pjrpid_element *dst,
  83. const pjrpid_element *src);
  84. /**
  85. * Add RPID element information into existing PIDF document. This will also
  86. * add the appropriate XML namespace attributes into the presence's XML
  87. * node, if the attributes are not already present, and also a <note> element
  88. * if it is not present. The <note> element is added to the first <tuple>
  89. * element of the PIDF document, or if there is no <tuple> element found,
  90. * to the root <presence> element of the document.
  91. *
  92. * @param pres The PIDF presence document.
  93. * @param pool Pool.
  94. * @param options Currently unused, and must be zero.
  95. * @param elem RPID element information to be added into the PIDF
  96. * document.
  97. *
  98. * @return PJ_SUCCESS on success.
  99. */
  100. PJ_DECL(pj_status_t) pjrpid_add_element(pjpidf_pres *pres,
  101. pj_pool_t *pool,
  102. unsigned options,
  103. const pjrpid_element *elem);
  104. /**
  105. * Get RPID element information from PIDF document, if any.
  106. *
  107. * @param pres The PIDF document containing RPID elements.
  108. * @param pool Pool to duplicate the information.
  109. * @param elem Structure to receive the element information.
  110. *
  111. * @return PJ_SUCCESS if the document does contain RPID element
  112. * and the information has been parsed successfully.
  113. */
  114. PJ_DECL(pj_status_t) pjrpid_get_element(const pjpidf_pres *pres,
  115. pj_pool_t *pool,
  116. pjrpid_element *elem);
  117. /**
  118. * @}
  119. */
  120. PJ_END_DECL
  121. #endif /* __PJSIP_SIMPLE_RPID_H__ */