~ubuntu-branches/ubuntu/vivid/sflphone/vivid

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.0.1/pjsip/include/pjsip-simple/pidf.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2013-06-30 11:40:56 UTC
  • mfrom: (4.1.18 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130630114056-0np50jkyqo6vnmii
Tags: 1.2.3-2
* changeset_r92d62cfc54732bbbcfff2b1d36c096b120b981a5.diff 
  - fixes automatic endian detection 
* Update Vcs: fixes vcs-field-not-canonical

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: pidf.h 3553 2011-05-05 06:14:19Z nanang $ */
 
2
/*
 
3
 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
 
4
 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
 */
 
20
#ifndef __PJSIP_SIMPLE_PIDF_H__
 
21
#define __PJSIP_SIMPLE_PIDF_H__
 
22
 
 
23
/**
 
24
 * @file pidf.h
 
25
 * @brief PIDF/Presence Information Data Format (RFC 3863)
 
26
 */
 
27
#include <pjsip-simple/types.h>
 
28
#include <pjlib-util/xml.h>
 
29
 
 
30
PJ_BEGIN_DECL
 
31
 
 
32
 
 
33
/**
 
34
 * @defgroup PJSIP_SIMPLE_PIDF PIDF/Presence Information Data Format (RFC 3863)
 
35
 * @ingroup PJSIP_SIMPLE
 
36
 * @brief Support for PIDF/Presence Information Data Format (RFC 3863)
 
37
 * @{
 
38
 *
 
39
 * This file provides tools for manipulating Presence Information Data
 
40
 * Format (PIDF) as described in RFC 3863.
 
41
 */
 
42
typedef struct pj_xml_node pjpidf_pres;
 
43
typedef struct pj_xml_node pjpidf_tuple;
 
44
typedef struct pj_xml_node pjpidf_status;
 
45
typedef struct pj_xml_node pjpidf_note;
 
46
 
 
47
typedef struct pjpidf_status_op
 
48
{
 
49
    void            (*construct)(pj_pool_t*, pjpidf_status*);
 
50
    pj_bool_t       (*is_basic_open)(const pjpidf_status*);
 
51
    void            (*set_basic_open)(pjpidf_status*, pj_bool_t);
 
52
} pjpidf_status_op;
 
53
 
 
54
typedef struct pjpidf_tuple_op
 
55
{
 
56
    void            (*construct)(pj_pool_t*, pjpidf_tuple*, const pj_str_t*);
 
57
 
 
58
    const pj_str_t* (*get_id)(const pjpidf_tuple* );
 
59
    void            (*set_id)(pj_pool_t*, pjpidf_tuple *, const pj_str_t*);
 
60
 
 
61
    pjpidf_status*  (*get_status)(pjpidf_tuple* );
 
62
 
 
63
    const pj_str_t* (*get_contact)(const pjpidf_tuple*);
 
64
    void            (*set_contact)(pj_pool_t*, pjpidf_tuple*, const pj_str_t*);
 
65
    void            (*set_contact_prio)(pj_pool_t*, pjpidf_tuple*, const pj_str_t*);
 
66
    const pj_str_t* (*get_contact_prio)(const pjpidf_tuple*);
 
67
 
 
68
    pjpidf_note*    (*add_note)(pj_pool_t*, pjpidf_tuple*, const pj_str_t*);
 
69
    pjpidf_note*    (*get_first_note)(pjpidf_tuple*);
 
70
    pjpidf_note*    (*get_next_note)(pjpidf_tuple*, pjpidf_note*);
 
71
 
 
72
    const pj_str_t* (*get_timestamp)(const pjpidf_tuple*);
 
73
    void            (*set_timestamp)(pj_pool_t*, pjpidf_tuple*, const pj_str_t*);
 
74
    void            (*set_timestamp_np)(pj_pool_t*,pjpidf_tuple*, pj_str_t*);
 
75
 
 
76
} pjpidf_tuple_op;
 
77
 
 
78
typedef struct pjpidf_pres_op
 
79
{
 
80
    void            (*construct)(pj_pool_t*, pjpidf_pres*, const pj_str_t*);
 
81
 
 
82
    pjpidf_tuple*   (*add_tuple)(pj_pool_t*, pjpidf_pres*, const pj_str_t*);
 
83
    pjpidf_tuple*   (*get_first_tuple)(pjpidf_pres*);
 
84
    pjpidf_tuple*   (*get_next_tuple)(pjpidf_pres*, pjpidf_tuple*);
 
85
    pjpidf_tuple*   (*find_tuple)(pjpidf_pres*, const pj_str_t*);
 
86
    void            (*remove_tuple)(pjpidf_pres*, pjpidf_tuple*);
 
87
 
 
88
    pjpidf_note*    (*add_note)(pj_pool_t*, pjpidf_pres*, const pj_str_t*);
 
89
    pjpidf_note*    (*get_first_note)(pjpidf_pres*);
 
90
    pjpidf_note*    (*get_next_note)(pjpidf_pres*, pjpidf_note*);
 
91
 
 
92
} pjpidf_pres_op;
 
93
 
 
94
 
 
95
extern struct pjpidf_op_desc
 
96
{
 
97
    pjpidf_pres_op      pres;
 
98
    pjpidf_tuple_op     tuple;
 
99
    pjpidf_status_op    status;
 
100
} pjpidf_op;
 
101
 
 
102
 
 
103
/******************************************************************************
 
104
 * Top level API for managing presence document.
 
105
 *****************************************************************************/
 
106
PJ_DECL(pjpidf_pres*)    pjpidf_create(pj_pool_t *pool, const pj_str_t *entity);
 
107
PJ_DECL(pjpidf_pres*)    pjpidf_parse(pj_pool_t *pool, char *text, int len);
 
108
PJ_DECL(int)             pjpidf_print(const pjpidf_pres* pres, char *buf, int len);
 
109
 
 
110
 
 
111
/******************************************************************************
 
112
 * API for managing Presence node.
 
113
 *****************************************************************************/
 
114
PJ_DECL(void)            pjpidf_pres_construct(pj_pool_t *pool, pjpidf_pres *pres,
 
115
                                               const pj_str_t *entity);
 
116
PJ_DECL(pjpidf_tuple*)   pjpidf_pres_add_tuple(pj_pool_t *pool, pjpidf_pres *pres,
 
117
                                               const pj_str_t *id);
 
118
PJ_DECL(pjpidf_tuple*)   pjpidf_pres_get_first_tuple(pjpidf_pres *pres);
 
119
PJ_DECL(pjpidf_tuple*)   pjpidf_pres_get_next_tuple(pjpidf_pres *pres,
 
120
                                                    pjpidf_tuple *t);
 
121
PJ_DECL(pjpidf_tuple*)   pjpidf_pres_find_tuple(pjpidf_pres *pres,
 
122
                                                const pj_str_t *id);
 
123
PJ_DECL(void)            pjpidf_pres_remove_tuple(pjpidf_pres *pres,
 
124
                                                  pjpidf_tuple*);
 
125
 
 
126
PJ_DECL(pjpidf_note*)    pjpidf_pres_add_note(pj_pool_t *pool, pjpidf_pres *pres,
 
127
                                              const pj_str_t *text);
 
128
PJ_DECL(pjpidf_note*)    pjpidf_pres_get_first_note(pjpidf_pres *pres);
 
129
PJ_DECL(pjpidf_note*)    pjpidf_pres_get_next_note(pjpidf_pres*, pjpidf_note*);
 
130
 
 
131
 
 
132
/******************************************************************************
 
133
 * API for managing Tuple node.
 
134
 *****************************************************************************/
 
135
PJ_DECL(void)            pjpidf_tuple_construct(pj_pool_t *pool, pjpidf_tuple *t,
 
136
                                                const pj_str_t *id);
 
137
PJ_DECL(const pj_str_t*) pjpidf_tuple_get_id(const pjpidf_tuple *t );
 
138
PJ_DECL(void)            pjpidf_tuple_set_id(pj_pool_t *pool, pjpidf_tuple *t,
 
139
                                             const pj_str_t *id);
 
140
 
 
141
PJ_DECL(pjpidf_status*)  pjpidf_tuple_get_status(pjpidf_tuple *t);
 
142
 
 
143
PJ_DECL(const pj_str_t*) pjpidf_tuple_get_contact(const pjpidf_tuple *t);
 
144
PJ_DECL(void)            pjpidf_tuple_set_contact(pj_pool_t *pool, pjpidf_tuple *t,
 
145
                                                  const pj_str_t *contact);
 
146
PJ_DECL(void)            pjpidf_tuple_set_contact_prio(pj_pool_t *pool, pjpidf_tuple *t,
 
147
                                                       const pj_str_t *prio);
 
148
PJ_DECL(const pj_str_t*) pjpidf_tuple_get_contact_prio(const pjpidf_tuple *t);
 
149
 
 
150
PJ_DECL(pjpidf_note*)    pjpidf_tuple_add_note(pj_pool_t *pool, pjpidf_tuple *t,
 
151
                                               const pj_str_t *text);
 
152
PJ_DECL(pjpidf_note*)    pjpidf_tuple_get_first_note(pjpidf_tuple *t);
 
153
PJ_DECL(pjpidf_note*)    pjpidf_tuple_get_next_note(pjpidf_tuple *t, pjpidf_note *n);
 
154
 
 
155
PJ_DECL(const pj_str_t*) pjpidf_tuple_get_timestamp(const pjpidf_tuple *t);
 
156
PJ_DECL(void)            pjpidf_tuple_set_timestamp(pj_pool_t *pool, pjpidf_tuple *t,
 
157
                                                    const pj_str_t *ts);
 
158
PJ_DECL(void)            pjpidf_tuple_set_timestamp_np( pj_pool_t*, pjpidf_tuple *t,
 
159
                                                        pj_str_t *ts);
 
160
 
 
161
 
 
162
/******************************************************************************
 
163
 * API for managing Status node.
 
164
 *****************************************************************************/
 
165
PJ_DECL(void)            pjpidf_status_construct(pj_pool_t*, pjpidf_status*);
 
166
PJ_DECL(pj_bool_t)       pjpidf_status_is_basic_open(const pjpidf_status*);
 
167
PJ_DECL(void)            pjpidf_status_set_basic_open(pjpidf_status*, pj_bool_t);
 
168
 
 
169
 
 
170
/**
 
171
 * @}
 
172
 */
 
173
 
 
174
 
 
175
PJ_END_DECL
 
176
 
 
177
 
 
178
#endif  /* __PJSIP_SIMPLE_PIDF_H__ */