summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsip_simple/xpidf.h
blob: a0a56aa3214110c56e794dc959be0101f110cb2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* $Header: /pjproject/pjsip/src/pjsip_simple/xpidf.h 3     8/24/05 10:33a Bennylp $ */
#ifndef __PJSIP_SIMPLE_XPIDF_H__
#define __PJSIP_SIMPLE_XPIDF_H__

/**
 * @file xpidf.h
 * @brief XPIDF/Presence Information Data Format
 */
#include <pj/types.h>
#include <pj/xml.h>

PJ_BEGIN_DECL

/**
 * @defgroup PJSIP_SIMPLE_XPIDF XPIDF/Presence Information Data Format
 * @ingroup PJSIP_SIMPLE
 * @{
 *
 * This is an old presence data format as described in:
 * draft-rosenberg-impp-pidf-00.txt.
 *
 * We won't support this format extensively here, as it seems there's not
 * too many implementations support this anymore, as it shouldn't.
 */

/** Type definitions for XPIDF root document. */
typedef pj_xml_node pjxpidf_pres;


/**
 * Create a new XPIDF document.
 *
 * @param pool	    Pool.
 * @param uri	    URI to set in the XPIDF document.
 *
 * @return	    XPIDF document.
 */
PJ_DECL(pjxpidf_pres*) pjxpidf_create(pj_pool_t *pool, const pj_str_t *uri);


/**
 * Parse XPIDF document.
 *
 * @param pool	    Pool.
 * @param text	    Input text.
 * @param len	    Length of input text.
 *
 * @return	    XPIDF document.
 */
PJ_DECL(pjxpidf_pres*) pjxpidf_parse(pj_pool_t *pool, char *text, pj_size_t len);


/**
 * Print XPIDF document.
 *
 * @param pres	    The XPIDF document to print.
 * @param text	    Buffer to place the output.
 * @param len	    Length of the buffer.
 *
 * @return	    The length printed.
 */
PJ_DECL(int) pjxpidf_print( pjxpidf_pres *pres, char *text, pj_size_t len);


/**
 * Get URI in the XPIDF document
 *
 * @param pres	    XPIDF document
 *
 * @return	    The URI, or an empty string.
 */
PJ_DECL(pj_str_t*) pjxpidf_get_uri(pjxpidf_pres *pres);


/**
 * Set the URI of the XPIDF document.
 *
 * @param pool	    Pool.
 * @param pres	    The XPIDF document.
 * @param uri	    URI to set in the XPIDF document.
 *
 * @return	    Zero on success.
 */
PJ_DECL(pj_status_t) pjxpidf_set_uri(pj_pool_t *pool, pjxpidf_pres *pres, 
				     const pj_str_t *uri);


/**
 * Get presence status in the XPIDF document.
 *
 * @param pres	    XPIDF document.
 *
 * @return	    True to indicate the contact is online.
 */
PJ_DECL(pj_bool_t) pjxpidf_get_status(pjxpidf_pres *pres);


/**
 * Set presence status in the XPIDF document.
 *
 * @param pres	    XPIDF document.
 * @param status    Status to set, True for online, False for offline.
 *
 * @return	    Zero on success.
 */
PJ_DECL(pj_status_t) pjxpidf_set_status(pjxpidf_pres *pres, pj_bool_t status);


/**
 * @}
 */

PJ_END_DECL


#endif	/* __PJSIP_SIMPLE_XPIDF_H__ */