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