sip 1.12.11devel
Loading...
Searching...
No Matches
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
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
47#endif
48
49SOFIA_BEGIN_DECLS
50
54 sip_via_t const *v,
55 char const *user,
56 char const *transport);
57
60 char const *user);
61
63char *
65 sip_via_t const *v,
66 char const *user,
67 char const *transport);
68
69SOFIAPUBFUN int sip_transport_has_tls(char const *transport_name);
70
72 sip_method_t method,
73 int *return_graceful_terminate);
74
75SOFIAPUBFUN int sip_sanity_check(sip_t const *sip);
76
77SOFIAPUBFUN unsigned sip_q_value(char const * q);
78
80
84#define SIP_STRLOG(prefix, s) ((s) ? (prefix) : ""), ((s) ? (s) : "")
85
86SOFIAPUBFUN int sip_addr_match(sip_addr_t const *a, sip_addr_t const *b);
87
88/* ----------------------------------------------------------------------
89 * Header-specific functions below
90 */
91
99
101 msg_hclass_t *,
102 sip_route_t const *);
104 msg_hclass_t *,
105 sip_route_t const *);
106
108
109/* ---------------------------------------------------------------------- */
110/* Caller preferences */
111
113SOFIAPUBFUN int sip_prefs_matching(char const *pvalue,
114 char const *nvalue,
115 int *return_parse_error);
116SOFIAPUBFUN int sip_is_callerpref(char const *param);
117
120 sp_error = -1,
121 sp_init,
122 sp_literal,
123 sp_string,
124 sp_range,
125};
126
127
130{
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
159 char const **in_out_s,
160 int *return_negation);
161
163SOFIAPUBFUN int sip_prefs_match(union sip_pref const *, union sip_pref const *);
164
166
171#define sip_contact_immune(m) sip_contact_is_immune(m)
172
174 sip_contact_t const *m);
175
177 sip_reject_contact_t const *rc);
178
180 sip_accept_contact_t const *cp,
181 unsigned *return_S,
182 unsigned *return_N,
183 int *return_error);
184
186 sip_accept_contact_t const *ac,
187 sip_reject_contact_t const *rc);
188
189
191
192/* sec-agree utility functions. */
193
194SOFIAPUBFUN 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
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
210SOFIA_END_DECLS
211
212#endif
sip_route_t * sip_route_pop(msg_t *msg, sip_t *sip)
Get last route header and remove it from its fragment chain.
Definition sip_util.c:483
sip_route_t * sip_route_fixdup(su_home_t *, sip_route_t const *)
Fix and duplicate a Route header.
Definition sip_util.c:638
sip_route_t * sip_route_fix(sip_route_t *route)
Fix Route header.
Definition sip_util.c:650
sip_route_t * sip_route_fixdup_as(su_home_t *, msg_hclass_t *, sip_route_t const *)
Fix and duplicate a route header (Route, Record-Route, Path, Service-Route).
Definition sip_util.c:596
sip_route_t * sip_route_follow(msg_t *msg, sip_t *sip)
Get first route header and rewrite the RequestURI.
Definition sip_util.c:501
sip_route_t * sip_route_remove(msg_t *msg, sip_t *sip)
Get first route header and remove it from its fragment chain.
Definition sip_util.c:468
sip_route_t * sip_route_reverse_as(su_home_t *, msg_hclass_t *, sip_route_t const *)
Reverse a route header (Route, Record-Route, Path, Service-Route).
Definition sip_util.c:541
int sip_route_is_loose(sip_route_t const *r)
Check if route header has lr param.
Definition sip_util.c:527
sip_route_t * sip_route_reverse(su_home_t *, sip_route_t const *)
Reverse a Route header.
Definition sip_util.c:585
sip_via_t * sip_via_remove(msg_t *msg, sip_t *sip)
Get first via header and remove it from its fragment chain.
Definition sip_util.c:685
struct msg_hclass_s const msg_hclass_t
SIP objects.
sip_method_t
IDs for well-known SIP methods.
Definition sip.h:48
sip_security_client_t const * sip_security_client_select(sip_security_client_t const *client, sip_security_server_t const *server)
Select best mechanism from Security-Client header.
Definition sip_util.c:806
int sip_is_callerpref(char const *param)
Check if the parameter is a valid feature tag.
Definition sip_pref_util.c:312
int sip_prefs_parse(union sip_pref *sp, char const **in_out_s, int *return_negation)
Parse a single preference.
Definition sip_pref_util.c:51
int sip_transport_has_tls(char const *transport_name)
Check if tranport name refers to TLS.
Definition sip_util.c:284
int sip_response_terminates_dialog(int response_code, sip_method_t method, int *return_graceful_terminate)
Checks if the response with given response code terminates dialog or dialog usage.
Definition sip_util.c:840
url_t * sip_url_dup(su_home_t *sh, url_t const *o)
Duplicate a url or make a url out of string.
Definition sip_util.c:440
int sip_contact_is_immune(sip_contact_t const *m)
Check if Contact is immune to callerprefs.
Definition sip_pref_util.c:371
char * sip_contact_string_from_via(su_home_t *home, sip_via_t const *v, char const *user, char const *transport)
Convert a Via header to Contact URL string.
Definition sip_util.c:220
int sip_prefs_match(union sip_pref const *, union sip_pref const *)
Match preferences.
Definition sip_pref_util.c:207
int sip_contact_reject(sip_contact_t const *m, sip_reject_contact_t const *rc)
Check if Contact is rejected by Reject-Contact.
Definition sip_pref_util.c:492
int sip_contact_score(sip_contact_t const *m, sip_accept_contact_t const *ac, sip_reject_contact_t const *rc)
Calculate score for contact.
Definition sip_pref_util.c:559
int sip_sanity_check(sip_t const *sip)
Perform sanity check on a SIP message.
Definition sip_util.c:309
sip_contact_t * sip_contact_create_from_via_with_transport(su_home_t *home, sip_via_t const *v, char const *user, char const *transport)
Convert a Via header to Contact header.
Definition sip_util.c:190
sip_contact_t * sip_contact_immunize(su_home_t *home, sip_contact_t const *m)
Immunize Contact to callerprefs.
Definition sip_pref_util.c:518
int sip_contact_accept(sip_contact_t const *m, sip_accept_contact_t const *cp, unsigned *return_S, unsigned *return_N, int *return_error)
Check if Contact matches by Accept-Contact.
Definition sip_pref_util.c:436
sip_contact_t * sip_contact_create_from_via(su_home_t *, sip_via_t const *, char const *user)
Convert a Via header to Contact header.
Definition sip_util.c:155
unsigned sip_q_value(char const *q)
Calculate Q value.
Definition sip_util.c:457
int sip_addr_match(sip_addr_t const *a, sip_addr_t const *b)
Compare two SIP addresses ( From or To headers).
Definition sip_util.c:67
sp_type
Type of the SIP media tag.
Definition sip_util.h:119
int sip_prefs_matching(char const *pvalue, char const *nvalue, int *return_parse_error)
Check callerprefs.
Definition sip_pref_util.c:251
int sip_aor_strip(url_t *url)
Remove extra parameters from an AOR URL.
Definition sip_util.c:728
Structure for From and To headers.
Definition sip.h:382
Structure for Accept-Contact and Reject-Contact header fields.
Definition sip.h:655
Structure for Contact header field.
Definition sip.h:473
Literal (tag="foo").
Definition sip_util.h:135
Numeric value or range (tag="#=1"; tag="#<=3"; tag="#>=-2"; tag="#1:6").
Definition sip_util.h:150
double spr_lower
Lower limit.
Definition sip_util.h:152
double spr_upper
Upper limit.
Definition sip_util.h:153
String (tag="<foo>").
Definition sip_util.h:142
Structure for Route and Record-Route header fields.
Definition sip.h:681
SIP message object.
Definition sip.h:230
Structure for Security-Client, Security-Server, and Security-Verify headers.
Definition sip.h:774
Structure for Via header field.
Definition sip.h:753
SU_HOME_T su_home_t
#define SOFIAPUBFUN
Possible values for SIP media tags.
Definition sip_util.h:130
enum sp_type sp_type
Type of the media tag.
Definition sip_util.h:132

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.