Debian Codegraph @

Xpjproject/pjsip/include/pjsip-simple/rpid.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <[email protected]>
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
29 PJ_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 4480, RPID: Rich Presence Extensions to the
45 * Presence Information Data Format (PIDF).
46 */
47 typedef 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 */
66 typedef 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 */
77 typedef 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 */
101 PJ_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 * if it is not present. The <note> element is added to the first <tuple>
110 * element of the PIDF document, or if there is no <tuple> element found,
111 * to the root <presence> element of the document.
112 *
113 * @param pres The PIDF presence document.
114 * @param pool Pool.
115 * @param options Currently unused, and must be zero.
116 * @param elem RPID element information to be added into the PIDF
117 * document.
118 *
119 * @return PJ_SUCCESS on success.
120 */
121 PJ_DECL(pj_status_t) pjrpid_add_element(pjpidf_pres *pres,
122 pj_pool_t *pool,
123 unsigned options,
124 const pjrpid_element *elem);
125
126 /**
127 * Get RPID element information from PIDF document, if any.
128 *
129 * @param pres The PIDF document containing RPID elements.
130 * @param pool Pool to duplicate the information.
131 * @param elem Structure to receive the element information.
132 *
133 * @return PJ_SUCCESS if the document does contain RPID element
134 * and the information has been parsed successfully.
135 */
136 PJ_DECL(pj_status_t) pjrpid_get_element(const pjpidf_pres *pres,
137 pj_pool_t *pool,
138 pjrpid_element *elem);
139
140
141 /**
142 * @}
143 */
144
145
146 PJ_END_DECL
147
148
149 #endif /* __PJSIP_SIMPLE_RPID_H__ */
150