~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.2.1/pjsip/include/pjsip-ua/sip_timer.h

  • Committer: Package Import Robot
  • Author(s): Francois Marier, Francois Marier, Mark Purcell
  • Date: 2014-10-18 15:08:50 UTC
  • mfrom: (1.1.12)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20141018150850-2exfk34ckb15pcwi
Tags: 1.4.1-0.1
[ Francois Marier ]
* Non-maintainer upload
* New upstream release (closes: #759576, #741130)
  - debian/rules +PJPROJECT_VERSION := 2.2.1
  - add upstream patch to fix broken TLS support
  - add patch to fix pjproject regression

[ Mark Purcell ]
* Build-Depends:
  - sflphone-daemon + libavformat-dev, libavcodec-dev, libswscale-dev,
  libavdevice-dev, libavutil-dev
  - sflphone-gnome + libclutter-gtk-1.0-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: sip_timer.h 4715 2014-01-24 09:32:27Z riza $ */
 
2
/* 
 
3
 * Copyright (C) 2009-2011 Teluu Inc. (http://www.teluu.com)
 
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_TIMER_H__
 
20
#define __PJSIP_TIMER_H__
 
21
 
 
22
 
 
23
/**
 
24
 * @file sip_timer.h
 
25
 * @brief SIP Session Timers support (RFC 4028 - Session Timer in SIP)
 
26
 */
 
27
 
 
28
#include <pjsip-ua/sip_inv.h>
 
29
#include <pjsip/sip_msg.h>
 
30
 
 
31
/**
 
32
 * @defgroup PJSIP_TIMER SIP Session Timers support (RFC 4028 - Session Timers in SIP)
 
33
 * @ingroup PJSIP_HIGH_UA
 
34
 * @brief SIP Session Timers support (RFC 4028 - Session Timers in SIP)
 
35
 * @{
 
36
 *
 
37
 * \section PJSIP_TIMER_REFERENCE References
 
38
 *
 
39
 * References:
 
40
 *  - <A HREF="http://www.ietf.org/rfc/rfc4028.txt">RFC 4028: Session Timers 
 
41
 *    in the Session Initiation Protocol (SIP)</A>
 
42
 */
 
43
 
 
44
PJ_BEGIN_DECL
 
45
 
 
46
/**
 
47
 * Opaque declaration of Session Timers.
 
48
 */
 
49
typedef struct pjsip_timer pjsip_timer;
 
50
 
 
51
 
 
52
/**
 
53
 * This structure describes Session Timers settings in an invite session.
 
54
 */
 
55
typedef struct pjsip_timer_setting
 
56
{
 
57
    /** 
 
58
     * Specify minimum session expiration period, in seconds. Must not be
 
59
     * lower than 90. Default is 90.
 
60
     */
 
61
    unsigned                     min_se;
 
62
 
 
63
    /**
 
64
     * Specify session expiration period, in seconds. Must not be lower than
 
65
     * #min_se. Default is 1800.
 
66
     */
 
67
    unsigned                     sess_expires;  
 
68
 
 
69
} pjsip_timer_setting;
 
70
 
 
71
 
 
72
/**
 
73
 * SIP Session-Expires header (RFC 4028).
 
74
 */
 
75
typedef struct pjsip_sess_expires_hdr
 
76
{
 
77
    /** Standard header field. */
 
78
    PJSIP_DECL_HDR_MEMBER(struct pjsip_sess_expires_hdr);
 
79
 
 
80
    /** Session expiration period */
 
81
    unsigned    sess_expires;
 
82
 
 
83
    /** Refresher */
 
84
    pj_str_t    refresher;
 
85
 
 
86
    /** Other parameters */
 
87
    pjsip_param other_param;
 
88
 
 
89
} pjsip_sess_expires_hdr;
 
90
 
 
91
 
 
92
/**
 
93
 * SIP Min-SE header (RFC 4028).
 
94
 */
 
95
typedef struct pjsip_min_se_hdr
 
96
{
 
97
    /** Standard header field. */
 
98
    PJSIP_DECL_HDR_MEMBER(struct pjsip_min_se_hdr);
 
99
 
 
100
    /** Minimum session expiration period */
 
101
    unsigned    min_se;
 
102
 
 
103
    /** Other parameters */
 
104
    pjsip_param other_param;
 
105
 
 
106
} pjsip_min_se_hdr;
 
107
 
 
108
 
 
109
 
 
110
/**
 
111
 * Initialize Session Timers module. This function must be called once during
 
112
 * application initialization, to register this module to SIP endpoint.
 
113
 *
 
114
 * @param endpt         The SIP endpoint instance.
 
115
 *
 
116
 * @return              PJ_SUCCESS if module is successfully initialized.
 
117
 */
 
118
PJ_DECL(pj_status_t) pjsip_timer_init_module(pjsip_endpoint *endpt);
 
119
 
 
120
 
 
121
/**
 
122
 * Initialize Session Timers setting with default values.
 
123
 *
 
124
 * @param setting       Session Timers setting to be initialized.
 
125
 *
 
126
 * @return              PJ_SUCCESS on successful.
 
127
 */
 
128
PJ_DECL(pj_status_t) pjsip_timer_setting_default(pjsip_timer_setting *setting);
 
129
 
 
130
 
 
131
/**
 
132
 * Initialize Session Timers for an invite session. This function should be
 
133
 * called by application to apply Session Timers setting, otherwise invite
 
134
 * session will apply default setting to the Session Timers.
 
135
 *
 
136
 * @param inv           The invite session.
 
137
 * @param setting       Session Timers setting, see @pjsip_timer_setting.
 
138
 *                      If setting is NULL, default setting will be applied.
 
139
 *
 
140
 * @return              PJ_SUCCESS on successful.
 
141
 */
 
142
PJ_DECL(pj_status_t) pjsip_timer_init_session(
 
143
                                        pjsip_inv_session *inv,
 
144
                                        const pjsip_timer_setting *setting);
 
145
 
 
146
 
 
147
/**
 
148
 * Create Session-Expires header.
 
149
 *
 
150
 * @param pool          Pool to allocate the header instance from.
 
151
 *
 
152
 * @return              An empty Session-Expires header instance.
 
153
 */
 
154
PJ_DECL(pjsip_sess_expires_hdr*) pjsip_sess_expires_hdr_create(
 
155
                                                        pj_pool_t *pool);
 
156
 
 
157
 
 
158
/**
 
159
 * Create Min-SE header.
 
160
 *
 
161
 * @param pool          Pool to allocate the header instance from.
 
162
 *
 
163
 * @return              An empty Min-SE header instance.
 
164
 */
 
165
PJ_DECL(pjsip_min_se_hdr*) pjsip_min_se_hdr_create(pj_pool_t *pool);
 
166
 
 
167
 
 
168
/**
 
169
 * Update outgoing request to insert Session Timers headers and also
 
170
 * signal Session Timers capability in Supported and/or Require headers.
 
171
 *
 
172
 * This function will be called internally by the invite session if it 
 
173
 * detects that the session needs Session Timers support.
 
174
 *
 
175
 * @param inv           The invite session.
 
176
 * @param tdata         Outgoing INVITE or UPDATE request.
 
177
 *
 
178
 * @return              PJ_SUCCESS on successful.
 
179
 */
 
180
PJ_DECL(pj_status_t) pjsip_timer_update_req(pjsip_inv_session *inv,
 
181
                                            pjsip_tx_data *tdata);
 
182
 
 
183
 
 
184
/**
 
185
 * Process Session Timers headers in incoming response, this function
 
186
 * will only process incoming response with status code 422 (Session
 
187
 * Interval Too Small) or 2xx (final response).
 
188
 *
 
189
 * This function will be called internally by the invite session if it 
 
190
 * detects that the session needs Session Timers support.
 
191
 *
 
192
 * @param inv           The invite session.
 
193
 * @param rdata         Incoming response data.
 
194
 * @param st_code       Output buffer to store corresponding SIP status code 
 
195
 *                      when function returning non-PJ_SUCCESS.
 
196
 *
 
197
 * @return              PJ_SUCCESS on successful.
 
198
 */
 
199
PJ_DECL(pj_status_t) pjsip_timer_process_resp(pjsip_inv_session *inv,
 
200
                                              const pjsip_rx_data *rdata,
 
201
                                              pjsip_status_code *st_code);
 
202
 
 
203
/**
 
204
 * Process Session Timers refresh error, this function will process
 
205
 * error from refresh request. The error will be handle according the
 
206
 * error code, i.e : BYE will be sent after error 503 (Transport Error).
 
207
 *
 
208
 * @param inv            The invite session.
 
209
 * @param event          The event that trigger the error.
 
210
 *
 
211
 * @return               PJ_SUCCESS on successful.
 
212
 */
 
213
PJ_DECL(pj_status_t)  pjsip_timer_handle_refresh_error(
 
214
                                            pjsip_inv_session *inv,
 
215
                                            pjsip_event *event);
 
216
 
 
217
/**
 
218
 * Process Session Timers headers in incoming request, this function
 
219
 * will only process incoming INVITE and UPDATE request.
 
220
 *
 
221
 * This function will be called internally by the invite session if it 
 
222
 * detects that the session needs Session Timers support.
 
223
 *
 
224
 * @param inv           The invite session.
 
225
 * @param rdata         Incoming INVITE or UPDATE request.
 
226
 * @param st_code       Output buffer to store corresponding SIP status code 
 
227
 *                      when function returning non-PJ_SUCCESS.
 
228
 *
 
229
 * @return              PJ_SUCCESS on successful.
 
230
 */
 
231
PJ_DECL(pj_status_t) pjsip_timer_process_req(pjsip_inv_session *inv,
 
232
                                             const pjsip_rx_data *rdata,
 
233
                                             pjsip_status_code *st_code);
 
234
 
 
235
 
 
236
/**
 
237
 * Update outgoing response to insert Session Timers headers and also
 
238
 * signal Session Timers capability in Supported and/or Require headers.
 
239
 * This function will only update outgoing response with status code 
 
240
 * 422 (Session Interval Too Small) or 2xx (final response).
 
241
 *
 
242
 * This function will be called internally by the invite session if it 
 
243
 * detects that the session needs Session Timers support.
 
244
 *
 
245
 * @param inv           The invite session.
 
246
 * @param tdata         Outgoing 422/2xx response.
 
247
 *
 
248
 * @return              PJ_SUCCESS on successful.
 
249
 */
 
250
PJ_DECL(pj_status_t) pjsip_timer_update_resp(pjsip_inv_session *inv,
 
251
                                             pjsip_tx_data *tdata);
 
252
 
 
253
/**
 
254
 * End Session Timers in an invite session.
 
255
 *
 
256
 * This function will be called internally by the invite session if it 
 
257
 * detects that the session needs Session Timers support.
 
258
 *
 
259
 * @param inv           The invite session.
 
260
 *
 
261
 * @return              PJ_SUCCESS on successful.
 
262
 */
 
263
PJ_DECL(pj_status_t) pjsip_timer_end_session(pjsip_inv_session *inv);
 
264
 
 
265
 
 
266
 
 
267
PJ_END_DECL
 
268
 
 
269
 
 
270
/**
 
271
 * @}
 
272
 */
 
273
 
 
274
 
 
275
#endif  /* __PJSIP_TIMER_H__ */