blob: 2f090a934b18ce3ccb805a3a0a2a67255fec9607 [file] [log] [blame]
Benny Prijono4461c7d2007-08-25 13:36:15 +00001/* $Id$ */
2/*
3 * Copyright (C) 2003-2007 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_RPID_H__
20#define __PJSIP_SIMPLE_RPID_H__
21
22/**
23 * @file rpid.h
24 * @brief RPID: Rich Presence Extensions to the PIDF (RFC 4480)
25 */
26#include <pjsip-simple/types.h>
27#include <pjsip-simple/pidf.h>
28
29PJ_BEGIN_DECL
30
31
32/**
33 * @defgroup PJSIP_SIMPLE_RPID RPID/Rich Presence Extensions to PIDF (RFC 4480)
34 * @ingroup PJSIP_SIMPLE
35 * @brief RPID/Rich Presence Extensions to PIDF (RFC 4480)
36 * @{
37 *
38 * This file provides tools for managing subset of RPID elements into
39 * PIDF document.
40 */
41
42/**
43 * This enumeration describes subset of standard activities as
44 * described by RFC 4880, RPID: Rich Presence Extensions to the
45 * Presence Information Data Format (PIDF).
46 */
47typedef enum pjrpid_activity
48{
49 /** Activity is unknown. The activity would then be conceived
50 * in the "note" field.
51 */
52 PJRPID_ACTIVITY_UNKNOWN,
53
54 /** The person is away */
55 PJRPID_ACTIVITY_AWAY,
56
57 /** The person is busy */
58 PJRPID_ACTIVITY_BUSY
59
60} pjrpid_activity;
61
62
63/**
64 * This enumeration describes types of RPID element.
65 */
66typedef enum pjrpid_element_type
67{
68 /** RPID <person> element */
69 PJRPID_ELEMENT_TYPE_PERSON
70
71} pjrpid_element_type;
72
73
74/**
75 * This structure describes person information in RPID document.
76 */
77typedef struct pjrpid_element
78{
79 /** Element type. */
80 pjrpid_element_type type;
81
82 /** Optional id to set on the element. */
83 pj_str_t id;
84
85 /** Activity type. */
86 pjrpid_activity activity;
87
88 /** Optional text describing the person/element. */
89 pj_str_t note;
90
91} pjrpid_element;
92
93
94/**
95 * Duplicate RPID element.
96 *
97 * @param pool Pool.
98 * @param dst Destination structure.
99 * @param src Source structure.
100 */
101PJ_DECL(void) pjrpid_element_dup(pj_pool_t *pool, pjrpid_element *dst,
102 const pjrpid_element *src);
103
104
105/**
106 * Add RPID element information into existing PIDF document. This will also
107 * add the appropriate XML namespace attributes into the presence's XML
108 * node, if the attributes are not already present, and also a <note> element
109 * to the first <tuple> element of the PIDF document.
110 *
111 * @param pres The PIDF presence document.
112 * @param pool Pool.
113 * @param options Currently unused, and must be zero.
114 * @param elem RPID element information to be added into the PIDF
115 * document.
116 *
117 * @return PJ_SUCCESS on success.
118 */
119PJ_DECL(pj_status_t) pjrpid_add_element(pjpidf_pres *pres,
120 pj_pool_t *pool,
121 unsigned options,
122 const pjrpid_element *elem);
123
124/**
125 * Get RPID element information from PIDF document, if any.
126 *
127 * @param pres The PIDF document containing RPID elements.
128 * @param pool Pool to duplicate the information.
129 * @param elem Structure to receive the element information.
130 *
131 * @return PJ_SUCCESS if the document does contain RPID element
132 * and the information has been parsed successfully.
133 */
134PJ_DECL(pj_status_t) pjrpid_get_element(const pjpidf_pres *pres,
135 pj_pool_t *pool,
136 pjrpid_element *elem);
137
138
139/**
140 * @}
141 */
142
143
144PJ_END_DECL
145
146
147#endif /* __PJSIP_SIMPLE_RPID_H__ */
148