sip
1.12.11devel
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
libsofia-sip-ua
sip
sofia-sip
sip_util.h
Go to the documentation of this file.
1
/*
2
* This file is part of the Sofia-SIP package
3
*
4
* Copyright (C) 2005 Nokia Corporation.
5
*
6
* Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
7
*
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public License
10
* as published by the Free Software Foundation; either version 2.1 of
11
* the License, or (at your option) any later version.
12
*
13
* This library is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21
* 02110-1301 USA
22
*
23
*/
24
25
#ifndef SIP_UTIL_H
26
27
#define SIP_UTIL_H
28
37
#ifndef SIP_H
38
#include <
sofia-sip/sip.h
>
39
#endif
40
41
#ifndef STRING0_H
42
#include <
sofia-sip/string0.h
>
43
#endif
44
45
#ifndef MSG_HEADER_H
46
#include <
sofia-sip/msg_header.h
>
47
#endif
48
49
SOFIA_BEGIN_DECLS
50
51
SOFIAPUBFUN
52
sip_contact_t
*
53
sip_contact_create_from_via_with_transport
(
su_home_t
*home,
54
sip_via_t
const
*v,
55
char
const
*user,
56
char
const
*transport);
57
58
SOFIAPUBFUN
59
sip_contact_t
*
sip_contact_create_from_via
(
su_home_t
*,
sip_via_t
const
*,
60
char
const
*user);
61
62
SOFIAPUBFUN
63
char
*
64
sip_contact_string_from_via
(
su_home_t
*home,
65
sip_via_t
const
*v,
66
char
const
*user,
67
char
const
*transport);
68
69
SOFIAPUBFUN
int
sip_transport_has_tls
(
char
const
*transport_name);
70
71
SOFIAPUBFUN
int
sip_response_terminates_dialog
(
int
response_code,
72
sip_method_t
method,
73
int
*return_graceful_terminate);
74
75
SOFIAPUBFUN
int
sip_sanity_check
(
sip_t
const
*sip);
76
77
SOFIAPUBFUN
unsigned
sip_q_value
(
char
const
* q);
78
79
SOFIAPUBFUN
url_t
*
sip_url_dup
(
su_home_t
*sh,
url_t
const
*o);
80
84
#define SIP_STRLOG(prefix, s) ((s) ? (prefix) : ""), ((s) ? (s) : "")
85
86
SOFIAPUBFUN
int
sip_addr_match
(
sip_addr_t
const
*a,
sip_addr_t
const
*b);
87
88
/* ----------------------------------------------------------------------
89
* Header-specific functions below
90
*/
91
92
SOFIAPUBFUN
int
sip_route_is_loose
(
sip_route_t
const
*r);
93
SOFIAPUBFUN
sip_route_t
*
sip_route_remove
(
msg_t
*msg,
sip_t
*sip);
94
SOFIAPUBFUN
sip_route_t
*
sip_route_pop
(
msg_t
*msg,
sip_t
*sip);
95
SOFIAPUBFUN
sip_route_t
*
sip_route_follow
(
msg_t
*msg,
sip_t
*sip);
96
SOFIAPUBFUN
sip_route_t
*
sip_route_reverse
(
su_home_t
*,
sip_route_t
const
*);
97
SOFIAPUBFUN
sip_route_t
*
sip_route_fixdup
(
su_home_t
*,
sip_route_t
const
*);
98
SOFIAPUBFUN
sip_route_t
*
sip_route_fix
(
sip_route_t
*route);
99
100
SOFIAPUBFUN
sip_route_t
*
sip_route_fixdup_as
(
su_home_t
*,
101
msg_hclass_t
*,
102
sip_route_t
const
*);
103
SOFIAPUBFUN
sip_route_t
*
sip_route_reverse_as
(
su_home_t
*,
104
msg_hclass_t
*,
105
sip_route_t
const
*);
106
107
SOFIAPUBFUN
sip_via_t
*
sip_via_remove
(
msg_t
*msg,
sip_t
*sip);
108
109
/* ---------------------------------------------------------------------- */
110
/* Caller preferences */
111
113
SOFIAPUBFUN
int
sip_prefs_matching
(
char
const
*pvalue,
114
char
const
*nvalue,
115
int
*return_parse_error);
116
SOFIAPUBFUN
int
sip_is_callerpref
(
char
const
*param);
117
119
enum
sp_type
{
120
sp_error = -1,
121
sp_init,
122
sp_literal,
123
sp_string,
124
sp_range,
125
};
126
127
129
union
sip_pref
130
{
132
enum
sp_type
sp_type
;
133
135
struct
sp_literal
{
136
enum
sp_type
spl_type;
137
char
const
*spl_value;
138
usize_t spl_length;
139
}
sp_literal
;
140
/* (tag="<foo>") */
142
struct
sp_string
{
143
enum
sp_type
sps_type;
144
char
const
*sps_value;
145
usize_t sps_length;
146
}
sp_string
;
147
150
struct
sp_range
{
151
enum
sp_type
spr_type;
152
double
spr_lower
;
153
double
spr_upper
;
154
}
sp_range
;
155
};
156
158
SOFIAPUBFUN
int
sip_prefs_parse
(
union
sip_pref
*sp,
159
char
const
**in_out_s,
160
int
*return_negation);
161
163
SOFIAPUBFUN
int
sip_prefs_match
(
union
sip_pref
const
*,
union
sip_pref
const
*);
164
165
SOFIAPUBFUN
int
sip_contact_is_immune
(
sip_contact_t
const
*m);
166
171
#define sip_contact_immune(m) sip_contact_is_immune(m)
172
173
SOFIAPUBFUN
sip_contact_t
*
sip_contact_immunize
(
su_home_t
*home,
174
sip_contact_t
const
*m);
175
176
SOFIAPUBFUN
int
sip_contact_reject
(
sip_contact_t
const
*m,
177
sip_reject_contact_t
const
*rc);
178
179
SOFIAPUBFUN
int
sip_contact_accept
(
sip_contact_t
const
*m,
180
sip_accept_contact_t
const
*cp,
181
unsigned
*return_S,
182
unsigned
*return_N,
183
int
*return_error);
184
185
SOFIAPUBFUN
int
sip_contact_score
(
sip_contact_t
const
*m,
186
sip_accept_contact_t
const
*ac,
187
sip_reject_contact_t
const
*rc);
188
189
190
SOFIAPUBFUN
int
sip_aor_strip
(
url_t
*url);
191
192
/* sec-agree utility functions. */
193
194
SOFIAPUBFUN
int
sip_security_verify_compare(
sip_security_server_t
const
*s,
195
sip_security_verify_t
const
*v,
196
char
const
**return_d_ver);
197
198
SOFIAPUBFUN
199
sip_security_client_t
const
*
200
sip_security_client_select
(
sip_security_client_t
const
*client,
201
sip_security_server_t
const
*server);
202
203
/* Compatibility stuff */
204
205
#define sip_params_add msg_params_add
206
#define sip_params_cmp msg_params_cmp
207
#define sip_params_replace msg_params_replace
208
#define sip_params_find msg_params_find
209
210
SOFIA_END_DECLS
211
212
#endif
Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.