Tristan Matthews | 0a329cc | 2013-07-17 13:20:14 -0400 | [diff] [blame] | 1 | /* $Id: rpid.h 3553 2011-05-05 06:14:19Z nanang $ */ |
| 2 | /* |
| 3 | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) |
| 4 | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> |
| 5 | * |
| 6 | * This program 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 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | #ifndef __PJSIP_SIMPLE_RPID_H__ |
| 21 | #define __PJSIP_SIMPLE_RPID_H__ |
| 22 | |
| 23 | /** |
| 24 | * @file rpid.h |
| 25 | * @brief RPID: Rich Presence Extensions to the PIDF (RFC 4480) |
| 26 | */ |
| 27 | #include <pjsip-simple/types.h> |
| 28 | #include <pjsip-simple/pidf.h> |
| 29 | |
| 30 | PJ_BEGIN_DECL |
| 31 | |
| 32 | |
| 33 | /** |
| 34 | * @defgroup PJSIP_SIMPLE_RPID RPID/Rich Presence Extensions to PIDF (RFC 4480) |
| 35 | * @ingroup PJSIP_SIMPLE |
| 36 | * @brief RPID/Rich Presence Extensions to PIDF (RFC 4480) |
| 37 | * @{ |
| 38 | * |
| 39 | * This file provides tools for managing subset of RPID elements into |
| 40 | * PIDF document. |
| 41 | */ |
| 42 | |
| 43 | /** |
| 44 | * This enumeration describes subset of standard activities as |
| 45 | * described by RFC 4880, RPID: Rich Presence Extensions to the |
| 46 | * Presence Information Data Format (PIDF). |
| 47 | */ |
| 48 | typedef enum pjrpid_activity |
| 49 | { |
| 50 | /** Activity is unknown. The activity would then be conceived |
| 51 | * in the "note" field. |
| 52 | */ |
| 53 | PJRPID_ACTIVITY_UNKNOWN, |
| 54 | |
| 55 | /** The person is away */ |
| 56 | PJRPID_ACTIVITY_AWAY, |
| 57 | |
| 58 | /** The person is busy */ |
| 59 | PJRPID_ACTIVITY_BUSY |
| 60 | |
| 61 | } pjrpid_activity; |
| 62 | |
| 63 | |
| 64 | /** |
| 65 | * This enumeration describes types of RPID element. |
| 66 | */ |
| 67 | typedef enum pjrpid_element_type |
| 68 | { |
| 69 | /** RPID <person> element */ |
| 70 | PJRPID_ELEMENT_TYPE_PERSON |
| 71 | |
| 72 | } pjrpid_element_type; |
| 73 | |
| 74 | |
| 75 | /** |
| 76 | * This structure describes person information in RPID document. |
| 77 | */ |
| 78 | typedef struct pjrpid_element |
| 79 | { |
| 80 | /** Element type. */ |
| 81 | pjrpid_element_type type; |
| 82 | |
| 83 | /** Optional id to set on the element. */ |
| 84 | pj_str_t id; |
| 85 | |
| 86 | /** Activity type. */ |
| 87 | pjrpid_activity activity; |
| 88 | |
| 89 | /** Optional text describing the person/element. */ |
| 90 | pj_str_t note; |
| 91 | |
| 92 | } pjrpid_element; |
| 93 | |
| 94 | |
| 95 | /** |
| 96 | * Duplicate RPID element. |
| 97 | * |
| 98 | * @param pool Pool. |
| 99 | * @param dst Destination structure. |
| 100 | * @param src Source structure. |
| 101 | */ |
| 102 | PJ_DECL(void) pjrpid_element_dup(pj_pool_t *pool, pjrpid_element *dst, |
| 103 | const pjrpid_element *src); |
| 104 | |
| 105 | |
| 106 | /** |
| 107 | * Add RPID element information into existing PIDF document. This will also |
| 108 | * add the appropriate XML namespace attributes into the presence's XML |
| 109 | * node, if the attributes are not already present, and also a <note> element |
| 110 | * to the first <tuple> element of the PIDF document. |
| 111 | * |
| 112 | * @param pres The PIDF presence document. |
| 113 | * @param pool Pool. |
| 114 | * @param options Currently unused, and must be zero. |
| 115 | * @param elem RPID element information to be added into the PIDF |
| 116 | * document. |
| 117 | * |
| 118 | * @return PJ_SUCCESS on success. |
| 119 | */ |
| 120 | PJ_DECL(pj_status_t) pjrpid_add_element(pjpidf_pres *pres, |
| 121 | pj_pool_t *pool, |
| 122 | unsigned options, |
| 123 | const pjrpid_element *elem); |
| 124 | |
| 125 | /** |
| 126 | * Get RPID element information from PIDF document, if any. |
| 127 | * |
| 128 | * @param pres The PIDF document containing RPID elements. |
| 129 | * @param pool Pool to duplicate the information. |
| 130 | * @param elem Structure to receive the element information. |
| 131 | * |
| 132 | * @return PJ_SUCCESS if the document does contain RPID element |
| 133 | * and the information has been parsed successfully. |
| 134 | */ |
| 135 | PJ_DECL(pj_status_t) pjrpid_get_element(const pjpidf_pres *pres, |
| 136 | pj_pool_t *pool, |
| 137 | pjrpid_element *elem); |
| 138 | |
| 139 | |
| 140 | /** |
| 141 | * @} |
| 142 | */ |
| 143 | |
| 144 | |
| 145 | PJ_END_DECL |
| 146 | |
| 147 | |
| 148 | #endif /* __PJSIP_SIMPLE_RPID_H__ */ |
| 149 | |