Loading...
Searching...
No Matches
sip_util.h
Go to the documentation of this file.
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SIP_UTIL_H
#define SIP_UTIL_H
#ifndef SIP_H
#include <sofia-sip/sip.h>
#endif
#ifndef STRING0_H
#include <sofia-sip/string0.h>
#endif
#ifndef MSG_HEADER_H
#include <sofia-sip/msg_header.h>
#endif
SOFIA_BEGIN_DECLS
SOFIAPUBFUN
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);
SOFIAPUBFUN
sip_contact_t *sip_contact_create_from_via(su_home_t *, sip_via_t const *,
char const *user);
SOFIAPUBFUN
char *
sip_contact_string_from_via(su_home_t *home,
sip_via_t const *v,
char const *user,
char const *transport);
SOFIAPUBFUN int sip_transport_has_tls(char const *transport_name);
SOFIAPUBFUN int sip_response_terminates_dialog(int response_code,
sip_method_t method,
int *return_graceful_terminate);
SOFIAPUBFUN int sip_sanity_check(sip_t const *sip);
SOFIAPUBFUN unsigned sip_q_value(char const * q);
SOFIAPUBFUN url_t *sip_url_dup(su_home_t *sh, url_t const *o);
#define SIP_STRLOG(prefix, s) ((s) ? (prefix) : ""), ((s) ? (s) : "")
SOFIAPUBFUN int sip_addr_match(sip_addr_t const *a, sip_addr_t const *b);
/* ----------------------------------------------------------------------
* Header-specific functions below
*/
SOFIAPUBFUN int sip_route_is_loose(sip_route_t const *r);
SOFIAPUBFUN sip_route_t *sip_route_remove(msg_t *msg, sip_t *sip);
SOFIAPUBFUN sip_route_t *sip_route_pop(msg_t *msg, sip_t *sip);
SOFIAPUBFUN sip_route_t *sip_route_follow(msg_t *msg, sip_t *sip);
SOFIAPUBFUN sip_route_t *sip_route_reverse(su_home_t *, sip_route_t const *);
SOFIAPUBFUN sip_route_t *sip_route_fixdup(su_home_t *, sip_route_t const *);
SOFIAPUBFUN sip_route_t *sip_route_fix(sip_route_t *route);
SOFIAPUBFUN sip_route_t *sip_route_fixdup_as(su_home_t *,
msg_hclass_t *,
sip_route_t const *);
SOFIAPUBFUN sip_route_t *sip_route_reverse_as(su_home_t *,
msg_hclass_t *,
sip_route_t const *);
SOFIAPUBFUN sip_via_t *sip_via_remove(msg_t *msg, sip_t *sip);
/* ---------------------------------------------------------------------- */
/* Caller preferences */
SOFIAPUBFUN int sip_prefs_matching(char const *pvalue,
char const *nvalue,
int *return_parse_error);
SOFIAPUBFUN int sip_is_callerpref(char const *param);
enum sp_type {
sp_error = -1,
sp_init,
sp_literal,
sp_string,
sp_range,
};
union sip_pref
{
enum sp_type sp_type;
struct sp_literal {
enum sp_type spl_type;
char const *spl_value;
usize_t spl_length;
} sp_literal;
/* (tag="<foo>") */
struct sp_string {
enum sp_type sps_type;
char const *sps_value;
usize_t sps_length;
} sp_string;
struct sp_range {
enum sp_type spr_type;
double spr_lower;
double spr_upper;
} sp_range;
};
SOFIAPUBFUN int sip_prefs_parse(union sip_pref *sp,
char const **in_out_s,
int *return_negation);
SOFIAPUBFUN int sip_prefs_match(union sip_pref const *, union sip_pref const *);
SOFIAPUBFUN int sip_contact_is_immune(sip_contact_t const *m);
#define sip_contact_immune(m) sip_contact_is_immune(m)
SOFIAPUBFUN sip_contact_t *sip_contact_immunize(su_home_t *home,
sip_contact_t const *m);
SOFIAPUBFUN int sip_contact_reject(sip_contact_t const *m,
sip_reject_contact_t const *rc);
SOFIAPUBFUN int sip_contact_accept(sip_contact_t const *m,
sip_accept_contact_t const *cp,
unsigned *return_S,
unsigned *return_N,
int *return_error);
SOFIAPUBFUN int sip_contact_score(sip_contact_t const *m,
sip_accept_contact_t const *ac,
sip_reject_contact_t const *rc);
SOFIAPUBFUN int sip_aor_strip(url_t *url);
/* sec-agree utility functions. */
SOFIAPUBFUN int sip_security_verify_compare(sip_security_server_t const *s,
sip_security_verify_t const *v,
char const **return_d_ver);
SOFIAPUBFUN
sip_security_client_t const *
sip_security_client_select(sip_security_client_t const *client,
sip_security_server_t const *server);
/* Compatibility stuff */
#define sip_params_add msg_params_add
#define sip_params_cmp msg_params_cmp
#define sip_params_replace msg_params_replace
#define sip_params_find msg_params_find
SOFIA_END_DECLS
#endif
sip_accept_contact_t
struct sip_caller_prefs_s sip_accept_contact_t
@
Definition sip.h:182
sip_contact_t
struct sip_contact_s sip_contact_t
@
Definition sip.h:147
sip_reject_contact_t
struct sip_caller_prefs_s sip_reject_contact_t
@
Definition sip.h:183
sip_route_pop
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_fixdup
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_fix
sip_route_t * sip_route_fix(sip_route_t *route)
Fix Route header.
Definition sip_util.c:650
sip_route_fixdup_as
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_follow
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_remove
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_reverse_as
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
sip_route_is_loose
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
struct sip_route_s sip_route_t
@
Definition sip.h:187
sip_route_reverse
sip_route_t * sip_route_reverse(su_home_t *, sip_route_t const *)
Reverse a Route header.
Definition sip_util.c:585
sip_security_client_t
struct sip_security_agree_s sip_security_client_t
@
Definition sip.h:214
sip_security_server_t
struct sip_security_agree_s sip_security_server_t
@
Definition sip.h:215
sip_security_verify_t
struct sip_security_agree_s sip_security_verify_t
@
Definition sip.h:216
sip_via_remove
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
sip_via_t
struct sip_via_s sip_via_t
@
Definition sip.h:200
msg_header.h
msg_hclass_t
struct msg_hclass_s const msg_hclass_t
msg_t
struct msg_s msg_t
sip.h
SIP objects.
sip_addr_t
struct sip_addr_s sip_addr_t
To or From header.
Definition sip.h:127
sip_t
struct sip_s sip_t
Structure for accessing parsed SIP headers.
Definition sip.h:111
sip_method_t
sip_method_t
IDs for well-known SIP methods.
Definition sip.h:48
sip_security_client_select
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
sip_is_callerpref
int sip_is_callerpref(char const *param)
Check if the parameter is a valid feature tag.
Definition sip_pref_util.c:312
sip_prefs_parse
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
sip_transport_has_tls
int sip_transport_has_tls(char const *transport_name)
Check if tranport name refers to TLS.
Definition sip_util.c:284
sip_response_terminates_dialog
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
sip_url_dup
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
sip_contact_is_immune
int sip_contact_is_immune(sip_contact_t const *m)
Check if Contact is immune to callerprefs.
Definition sip_pref_util.c:371
sip_contact_string_from_via
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
sip_prefs_match
int sip_prefs_match(union sip_pref const *, union sip_pref const *)
Match preferences.
Definition sip_pref_util.c:207
sip_contact_reject
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
sip_contact_score
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
sip_sanity_check
int sip_sanity_check(sip_t const *sip)
Perform sanity check on a SIP message.
Definition sip_util.c:309
sip_contact_create_from_via_with_transport
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_immunize
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
sip_contact_accept
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_create_from_via
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
sip_q_value
unsigned sip_q_value(char const *q)
Calculate Q value.
Definition sip_util.c:457
sip_addr_match
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
sp_type
Type of the SIP media tag.
Definition sip_util.h:119
sip_prefs_matching
int sip_prefs_matching(char const *pvalue, char const *nvalue, int *return_parse_error)
Check callerprefs.
Definition sip_pref_util.c:251
sip_aor_strip
int sip_aor_strip(url_t *url)
Remove extra parameters from an AOR URL.
Definition sip_util.c:728
string0.h
sip_pref::sp_literal
Literal (tag="foo").
Definition sip_util.h:135
sip_pref::sp_range
Numeric value or range (tag="#=1"; tag="#<=3"; tag="#>=-2"; tag="#1:6").
Definition sip_util.h:150
sip_pref::sp_range::spr_lower
double spr_lower
Lower limit.
Definition sip_util.h:152
sip_pref::sp_range::spr_upper
double spr_upper
Upper limit.
Definition sip_util.h:153
sip_pref::sp_string
String (tag="<foo>").
Definition sip_util.h:142
url_t
su_home_t
SU_HOME_T su_home_t
SOFIAPUBFUN
#define SOFIAPUBFUN
sip_pref
Possible values for SIP media tags.
Definition sip_util.h:130
sip_pref::sp_type
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.