blob: c5736c54240a2beaedf94b4be168e68c624173d7 [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
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. */
44typedef 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 */
55PJ_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 */
67PJ_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 */
79PJ_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 */
89PJ_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 */
101PJ_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 */
112PJ_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 */
123PJ_DECL(pj_status_t) pjxpidf_set_status(pjxpidf_pres *pres, pj_bool_t status);
124
125
126/**
127 * @}
128 */
129
130PJ_END_DECL
131
132
133#endif /* __PJSIP_SIMPLE_XPIDF_H__ */