Alexandre Lision | 8af73cb | 2013-12-10 14:11:20 -0500 | [diff] [blame] | 1 | /* $Id$ */ |
| 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_XPIDF_H__ |
| 21 | #define __PJSIP_SIMPLE_XPIDF_H__ |
| 22 | |
| 23 | /** |
| 24 | * @file xpidf.h |
| 25 | * @brief XPIDF/Presence Information Data Format |
| 26 | */ |
| 27 | #include <pjsip-simple/types.h> |
| 28 | #include <pjlib-util/xml.h> |
| 29 | |
| 30 | PJ_BEGIN_DECL |
| 31 | |
| 32 | /** |
| 33 | * @defgroup PJSIP_SIMPLE_XPIDF XPIDF/Presence Information Data Format |
| 34 | * @ingroup PJSIP_SIMPLE |
| 35 | * @brief Support for XPIDF/Presence Information Data Format |
| 36 | * @{ |
| 37 | * |
| 38 | * This is an old presence data format as described in: |
| 39 | * draft-rosenberg-impp-pidf-00.txt. |
| 40 | * |
| 41 | * We won't support this format extensively here, as it seems there's not |
| 42 | * too many implementations support this anymore, as it shouldn't. |
| 43 | */ |
| 44 | |
| 45 | /** Type definitions for XPIDF root document. */ |
| 46 | typedef pj_xml_node pjxpidf_pres; |
| 47 | |
| 48 | |
| 49 | /** |
| 50 | * Create a new XPIDF document. |
| 51 | * |
| 52 | * @param pool Pool. |
| 53 | * @param uri URI to set in the XPIDF document. |
| 54 | * |
| 55 | * @return XPIDF document. |
| 56 | */ |
| 57 | PJ_DECL(pjxpidf_pres*) pjxpidf_create(pj_pool_t *pool, const pj_str_t *uri); |
| 58 | |
| 59 | |
| 60 | /** |
| 61 | * Parse XPIDF document. |
| 62 | * |
| 63 | * @param pool Pool. |
| 64 | * @param text Input text. |
| 65 | * @param len Length of input text. |
| 66 | * |
| 67 | * @return XPIDF document. |
| 68 | */ |
| 69 | PJ_DECL(pjxpidf_pres*) pjxpidf_parse(pj_pool_t *pool, char *text, pj_size_t len); |
| 70 | |
| 71 | |
| 72 | /** |
| 73 | * Print XPIDF document. |
| 74 | * |
| 75 | * @param pres The XPIDF document to print. |
| 76 | * @param text Buffer to place the output. |
| 77 | * @param len Length of the buffer. |
| 78 | * |
| 79 | * @return The length printed. |
| 80 | */ |
| 81 | PJ_DECL(int) pjxpidf_print( pjxpidf_pres *pres, char *text, pj_size_t len); |
| 82 | |
| 83 | |
| 84 | /** |
| 85 | * Get URI in the XPIDF document |
| 86 | * |
| 87 | * @param pres XPIDF document |
| 88 | * |
| 89 | * @return The URI, or an empty string. |
| 90 | */ |
| 91 | PJ_DECL(pj_str_t*) pjxpidf_get_uri(pjxpidf_pres *pres); |
| 92 | |
| 93 | |
| 94 | /** |
| 95 | * Set the URI of the XPIDF document. |
| 96 | * |
| 97 | * @param pool Pool. |
| 98 | * @param pres The XPIDF document. |
| 99 | * @param uri URI to set in the XPIDF document. |
| 100 | * |
| 101 | * @return Zero on success. |
| 102 | */ |
| 103 | PJ_DECL(pj_status_t) pjxpidf_set_uri(pj_pool_t *pool, pjxpidf_pres *pres, |
| 104 | const pj_str_t *uri); |
| 105 | |
| 106 | |
| 107 | /** |
| 108 | * Get presence status in the XPIDF document. |
| 109 | * |
| 110 | * @param pres XPIDF document. |
| 111 | * |
| 112 | * @return True to indicate the contact is online. |
| 113 | */ |
| 114 | PJ_DECL(pj_bool_t) pjxpidf_get_status(pjxpidf_pres *pres); |
| 115 | |
| 116 | |
| 117 | /** |
| 118 | * Set presence status in the XPIDF document. |
| 119 | * |
| 120 | * @param pres XPIDF document. |
| 121 | * @param status Status to set, True for online, False for offline. |
| 122 | * |
| 123 | * @return Zero on success. |
| 124 | */ |
| 125 | PJ_DECL(pj_status_t) pjxpidf_set_status(pjxpidf_pres *pres, pj_bool_t status); |
| 126 | |
| 127 | |
| 128 | /** |
| 129 | * @} |
| 130 | */ |
| 131 | |
| 132 | PJ_END_DECL |
| 133 | |
| 134 | |
| 135 | #endif /* __PJSIP_SIMPLE_XPIDF_H__ */ |