~ubuntu-branches/ubuntu/raring/sflphone/raring

« back to all changes in this revision

Viewing changes to sflphone-common/libs/pjproject/pjsip/include/pjsip-ua/sip_timer.h

  • Committer: Package Import Robot
  • Author(s): Francois Marier
  • Date: 2011-11-25 13:24:12 UTC
  • mfrom: (4.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20111125132412-dc4qvhyosk74cd42
Tags: 1.0.1-4
Don't assume that arch:all packages will get built (closes: #649726)

Show diffs side-by-side

added added

removed removed

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