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