Debian Codegraph @

Xpjproject/pjsip/include/pjsip-simple/pidf.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_PIDF_H__
20 #define __PJSIP_SIMPLE_PIDF_H__
21
22 /**
23 * @file pidf.h
24 * @brief PIDF/Presence Information Data Format (RFC 3863)
25 */
26 #include <pjsip-simple/types.h>
27 #include <pjlib-util/xml.h>
28
29 PJ_BEGIN_DECL
30
31
32 /**
33 * @defgroup PJSIP_SIMPLE_PIDF PIDF/Presence Information Data Format (RFC 3863)
34 * @ingroup PJSIP_SIMPLE
35 * @brief Support for PIDF/Presence Information Data Format (RFC 3863)
36 * @{
37 *
38 * This file provides tools for manipulating Presence Information Data
39 * Format (PIDF) as described in RFC 3863.
40 */
41 typedef struct pj_xml_node pjpidf_pres;
42 typedef struct pj_xml_node pjpidf_tuple;
43 typedef struct pj_xml_node pjpidf_status;
44 typedef struct pj_xml_node pjpidf_note;
45
46 typedef struct pjpidf_status_op
47 {
48 void (*construct)(pj_pool_t*, pjpidf_status*);
49 pj_bool_t (*is_basic_open)(const pjpidf_status*);
50 void (*set_basic_open)(pjpidf_status*, pj_bool_t);
51 } pjpidf_status_op;
52
53 typedef struct pjpidf_tuple_op
54 {
55 void (*construct)(pj_pool_t*, pjpidf_tuple*, const pj_str_t*);
56
57 const pj_str_t* (*get_id)(const pjpidf_tuple* );
58 void (*set_id)(pj_pool_t*, pjpidf_tuple *, const pj_str_t*);
59
60 pjpidf_status* (*get_status)(pjpidf_tuple* );
61
62 const pj_str_t* (*get_contact)(const pjpidf_tuple*);
63 void (*set_contact)(pj_pool_t*, pjpidf_tuple*, const pj_str_t*);
64 void (*set_contact_prio)(pj_pool_t*, pjpidf_tuple*, const pj_str_t*);
65 const pj_str_t* (*get_contact_prio)(const pjpidf_tuple*);
66
67 pjpidf_note* (*add_note)(pj_pool_t*, pjpidf_tuple*, const pj_str_t*);
68 pjpidf_note* (*get_first_note)(pjpidf_tuple*);
69 pjpidf_note* (*get_next_note)(pjpidf_tuple*, pjpidf_note*);
70
71 const pj_str_t* (*get_timestamp)(const pjpidf_tuple*);
72 void (*set_timestamp)(pj_pool_t*, pjpidf_tuple*, const pj_str_t*);
73 void (*set_timestamp_np)(pj_pool_t*,pjpidf_tuple*, pj_str_t*);
74
75 } pjpidf_tuple_op;
76
77 typedef struct pjpidf_pres_op
78 {
79 void (*construct)(pj_pool_t*, pjpidf_pres*, const pj_str_t*);
80
81 pjpidf_tuple* (*add_tuple)(pj_pool_t*, pjpidf_pres*, const pj_str_t*);
82 pjpidf_tuple* (*get_first_tuple)(pjpidf_pres*);
83 pjpidf_tuple* (*get_next_tuple)(pjpidf_pres*, pjpidf_tuple*);
84 pjpidf_tuple* (*find_tuple)(pjpidf_pres*, const pj_str_t*);
85 void (*remove_tuple)(pjpidf_pres*, pjpidf_tuple*);
86
87 pjpidf_note* (*add_note)(pj_pool_t*, pjpidf_pres*, const pj_str_t*);
88 pjpidf_note* (*get_first_note)(pjpidf_pres*);
89 pjpidf_note* (*get_next_note)(pjpidf_pres*, pjpidf_note*);
90
91 } pjpidf_pres_op;
92
93
94 extern struct pjpidf_op_desc
95 {
96 pjpidf_pres_op pres;
97 pjpidf_tuple_op tuple;
98 pjpidf_status_op status;
99 } pjpidf_op;
100
101
102 /******************************************************************************
103 * Top level API for managing presence document.
104 *****************************************************************************/
105 PJ_DECL(pjpidf_pres*) pjpidf_create(pj_pool_t *pool, const pj_str_t *entity);
106 PJ_DECL(pjpidf_pres*) pjpidf_parse(pj_pool_t *pool, char *text, int len);
107 PJ_DECL(int) pjpidf_print(const pjpidf_pres* pres, char *buf, int len);
108
109
110 /******************************************************************************
111 * API for managing Presence node.
112 *****************************************************************************/
113 PJ_DECL(void) pjpidf_pres_construct(pj_pool_t *pool, pjpidf_pres *pres,
114 const pj_str_t *entity);
115 PJ_DECL(pjpidf_tuple*) pjpidf_pres_add_tuple(pj_pool_t *pool, pjpidf_pres *pres,
116 const pj_str_t *id);
117 PJ_DECL(pjpidf_tuple*) pjpidf_pres_get_first_tuple(pjpidf_pres *pres);
118 PJ_DECL(pjpidf_tuple*) pjpidf_pres_get_next_tuple(pjpidf_pres *pres,
119 pjpidf_tuple *t);
120 PJ_DECL(pjpidf_tuple*) pjpidf_pres_find_tuple(pjpidf_pres *pres,
121 const pj_str_t *id);
122 PJ_DECL(void) pjpidf_pres_remove_tuple(pjpidf_pres *pres,
123 pjpidf_tuple*);
124
125 PJ_DECL(pjpidf_note*) pjpidf_pres_add_note(pj_pool_t *pool, pjpidf_pres *pres,
126 const pj_str_t *text);
127 PJ_DECL(pjpidf_note*) pjpidf_pres_get_first_note(pjpidf_pres *pres);
128 PJ_DECL(pjpidf_note*) pjpidf_pres_get_next_note(pjpidf_pres*, pjpidf_note*);
129
130
131 /******************************************************************************
132 * API for managing Tuple node.
133 *****************************************************************************/
134 PJ_DECL(void) pjpidf_tuple_construct(pj_pool_t *pool, pjpidf_tuple *t,
135 const pj_str_t *id);
136 PJ_DECL(const pj_str_t*) pjpidf_tuple_get_id(const pjpidf_tuple *t );
137 PJ_DECL(void) pjpidf_tuple_set_id(pj_pool_t *pool, pjpidf_tuple *t,
138 const pj_str_t *id);
139
140 PJ_DECL(pjpidf_status*) pjpidf_tuple_get_status(pjpidf_tuple *t);
141
142 PJ_DECL(const pj_str_t*) pjpidf_tuple_get_contact(const pjpidf_tuple *t);
143 PJ_DECL(void) pjpidf_tuple_set_contact(pj_pool_t *pool, pjpidf_tuple *t,
144 const pj_str_t *contact);
145 PJ_DECL(void) pjpidf_tuple_set_contact_prio(pj_pool_t *pool, pjpidf_tuple *t,
146 const pj_str_t *prio);
147 PJ_DECL(const pj_str_t*) pjpidf_tuple_get_contact_prio(const pjpidf_tuple *t);
148
149 PJ_DECL(pjpidf_note*) pjpidf_tuple_add_note(pj_pool_t *pool, pjpidf_tuple *t,
150 const pj_str_t *text);
151 PJ_DECL(pjpidf_note*) pjpidf_tuple_get_first_note(pjpidf_tuple *t);
152 PJ_DECL(pjpidf_note*) pjpidf_tuple_get_next_note(pjpidf_tuple *t, pjpidf_note *n);
153
154 PJ_DECL(const pj_str_t*) pjpidf_tuple_get_timestamp(const pjpidf_tuple *t);
155 PJ_DECL(void) pjpidf_tuple_set_timestamp(pj_pool_t *pool, pjpidf_tuple *t,
156 const pj_str_t *ts);
157 PJ_DECL(void) pjpidf_tuple_set_timestamp_np( pj_pool_t*, pjpidf_tuple *t,
158 pj_str_t *ts);
159
160
161 /******************************************************************************
162 * API for managing Status node.
163 *****************************************************************************/
164 PJ_DECL(void) pjpidf_status_construct(pj_pool_t*, pjpidf_status*);
165 PJ_DECL(pj_bool_t) pjpidf_status_is_basic_open(const pjpidf_status*);
166 PJ_DECL(void) pjpidf_status_set_basic_open(pjpidf_status*, pj_bool_t);
167
168
169 /**
170 * @}
171 */
172
173
174 PJ_END_DECL
175
176
177 #endif /* __PJSIP_SIMPLE_PIDF_H__ */