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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
/* $Id$ */
/*
* Copyright (C) 2003-2007 Benny Prijono <benny@prijono.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __PJSIP_SIMPLE_RPID_H__
#define __PJSIP_SIMPLE_RPID_H__
/**
* @file rpid.h
* @brief RPID: Rich Presence Extensions to the PIDF (RFC 4480)
*/
#include <pjsip-simple/types.h>
#include <pjsip-simple/pidf.h>
PJ_BEGIN_DECL
/**
* @defgroup PJSIP_SIMPLE_RPID RPID/Rich Presence Extensions to PIDF (RFC 4480)
* @ingroup PJSIP_SIMPLE
* @brief RPID/Rich Presence Extensions to PIDF (RFC 4480)
* @{
*
* This file provides tools for managing subset of RPID elements into
* PIDF document.
*/
/**
* This enumeration describes subset of standard activities as
* described by RFC 4880, RPID: Rich Presence Extensions to the
* Presence Information Data Format (PIDF).
*/
typedef enum pjrpid_activity
{
/** Activity is unknown. The activity would then be conceived
* in the "note" field.
*/
PJRPID_ACTIVITY_UNKNOWN,
/** The person is away */
PJRPID_ACTIVITY_AWAY,
/** The person is busy */
PJRPID_ACTIVITY_BUSY
} pjrpid_activity;
/**
* This enumeration describes types of RPID element.
*/
typedef enum pjrpid_element_type
{
/** RPID <person> element */
PJRPID_ELEMENT_TYPE_PERSON
} pjrpid_element_type;
/**
* This structure describes person information in RPID document.
*/
typedef struct pjrpid_element
{
/** Element type. */
pjrpid_element_type type;
/** Optional id to set on the element. */
pj_str_t id;
/** Activity type. */
pjrpid_activity activity;
/** Optional text describing the person/element. */
pj_str_t note;
} pjrpid_element;
/**
* Duplicate RPID element.
*
* @param pool Pool.
* @param dst Destination structure.
* @param src Source structure.
*/
PJ_DECL(void) pjrpid_element_dup(pj_pool_t *pool, pjrpid_element *dst,
const pjrpid_element *src);
/**
* Add RPID element information into existing PIDF document. This will also
* add the appropriate XML namespace attributes into the presence's XML
* node, if the attributes are not already present, and also a <note> element
* to the first <tuple> element of the PIDF document.
*
* @param pres The PIDF presence document.
* @param pool Pool.
* @param options Currently unused, and must be zero.
* @param elem RPID element information to be added into the PIDF
* document.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjrpid_add_element(pjpidf_pres *pres,
pj_pool_t *pool,
unsigned options,
const pjrpid_element *elem);
/**
* Get RPID element information from PIDF document, if any.
*
* @param pres The PIDF document containing RPID elements.
* @param pool Pool to duplicate the information.
* @param elem Structure to receive the element information.
*
* @return PJ_SUCCESS if the document does contain RPID element
* and the information has been parsed successfully.
*/
PJ_DECL(pj_status_t) pjrpid_get_element(const pjpidf_pres *pres,
pj_pool_t *pool,
pjrpid_element *elem);
/**
* @}
*/
PJ_END_DECL
#endif /* __PJSIP_SIMPLE_RPID_H__ */
|