sofia-sip/sip_util.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of the Sofia-SIP package
00003  *
00004  * Copyright (C) 2005 Nokia Corporation.
00005  *
00006  * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation; either version 2.1 of
00011  * the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  *
00023  */
00024 
00025 #ifndef SIP_UTIL_H
00026 
00027 #define SIP_UTIL_H 
00028 
00037 #ifndef SIP_H
00038 #include <sofia-sip/sip.h>
00039 #endif
00040 
00041 #ifndef STRING0_H
00042 #include <sofia-sip/string0.h>
00043 #endif
00044 
00045 SOFIA_BEGIN_DECLS
00046 
00047 /* @deprecated
00048  * These are just wrappers around msg_params_*() functions. 
00049  *
00050  * Use msg_header_*_param() functions instead.
00051  */
00052 SOFIAPUBFUN char const *sip_params_find(sip_param_t const pp[],
00053                                         char const *token);
00054 SOFIAPUBFUN int sip_params_add(su_home_t *sh, 
00055                                sip_param_t **pparams,
00056                                char const *param);
00057 SOFIAPUBFUN int sip_params_cmp(sip_param_t const a[], sip_param_t const b[]);
00058 SOFIAPUBFUN int sip_params_replace(su_home_t *,
00059                                    sip_param_t **pparams, char const *param);
00060 
00061 SOFIAPUBFUN
00062 sip_contact_t *
00063 sip_contact_create_from_via_with_transport(su_home_t *home, 
00064                                            sip_via_t const *v,
00065                                            char const *user,
00066                                            char const *transport);
00067 
00068 SOFIAPUBFUN
00069 sip_contact_t *sip_contact_create_from_via(su_home_t *, sip_via_t const *,
00070                                            char const *user);
00071 
00072 SOFIAPUBFUN
00073 char *
00074 sip_contact_string_from_via(su_home_t *home,
00075                             sip_via_t const *v,
00076                             char const *user,
00077                             char const *transport);
00078 
00079 SOFIAPUBFUN int sip_transport_has_tls(char const *transport_name);
00080 
00081 SOFIAPUBFUN int sip_response_terminates_dialog(int response_code,
00082                                                sip_method_t method,
00083                                                int *return_graceful_terminate);
00084 
00085 SOFIAPUBFUN int sip_sanity_check(sip_t const *sip);
00086 
00087 SOFIAPUBFUN unsigned sip_q_value(char const * q);
00088 
00089 SOFIAPUBFUN url_t *sip_url_dup(su_home_t *sh, url_t const *o);
00090 
00094 #define SIP_STRLOG(prefix, s) ((s) ? (prefix) : ""), ((s) ? (s) : "")
00095 
00096 SOFIAPUBFUN int sip_addr_match(sip_addr_t const *a, sip_addr_t const *b);
00097 
00098 /* ----------------------------------------------------------------------
00099  * Header-specific functions below
00100  */
00101 
00102 SOFIAPUBFUN int sip_route_is_loose(sip_route_t const *r);
00103 SOFIAPUBFUN sip_route_t *sip_route_remove(msg_t *msg, sip_t *sip);
00104 SOFIAPUBFUN sip_route_t *sip_route_pop(msg_t *msg, sip_t *sip);
00105 SOFIAPUBFUN sip_route_t *sip_route_follow(msg_t *msg, sip_t *sip);
00106 SOFIAPUBFUN sip_route_t *sip_route_reverse(su_home_t *, sip_route_t const *);
00107 SOFIAPUBFUN sip_route_t *sip_route_fixdup(su_home_t *, sip_route_t const *);
00108 SOFIAPUBFUN sip_route_t *sip_route_fix(sip_route_t *route);
00109 
00110 SOFIAPUBFUN sip_route_t *sip_route_fixdup_as(su_home_t *,
00111                                              msg_hclass_t const *,
00112                                              sip_route_t const *);
00113 SOFIAPUBFUN sip_route_t *sip_route_reverse_as(su_home_t *,
00114                                              msg_hclass_t const *,
00115                                              sip_route_t const *);
00116 
00117 SOFIAPUBFUN sip_via_t *sip_via_remove(msg_t *msg, sip_t *sip);
00118 
00119 /* ---------------------------------------------------------------------- */
00120 /* Caller preferences */
00121 
00123 SOFIAPUBFUN int sip_prefs_matching(char const *pvalue,
00124                                    char const *nvalue,                 
00125                                    int *return_parse_error);
00126 SOFIAPUBFUN int sip_is_callerpref(char const *param);
00127 
00129 enum sp_type { 
00130   sp_error = -1, 
00131   sp_init,
00132   sp_literal,
00133   sp_string,
00134   sp_range,
00135 };
00136 
00137 
00139 union sip_pref
00140 {
00142   enum sp_type sp_type;
00143 
00145   struct sp_literal {
00146     enum sp_type spl_type; 
00147     char const *spl_value;
00148     unsigned spl_length;
00149   } sp_literal;
00150 
00152   struct sp_string {
00153     enum sp_type sps_type;
00154     char const *sps_value;
00155     unsigned sps_length;
00156   } sp_string;
00157 
00160   struct sp_range {
00161     enum sp_type spr_type;
00162     double spr_lower;
00163     double spr_upper;
00164   } sp_range;
00165 };
00166 
00168 SOFIAPUBFUN int sip_prefs_parse(union sip_pref *sp, 
00169                     char const **in_out_s, 
00170                     int *return_negation);
00171 
00173 SOFIAPUBFUN int sip_prefs_match(union sip_pref const *, union sip_pref const *);
00174 
00175 SOFIAPUBFUN int sip_contact_is_immune(sip_contact_t const *m);
00176 
00181 #define sip_contact_immune(m) sip_contact_is_immune(m)
00182 
00183 SOFIAPUBFUN sip_contact_t *sip_contact_immunize(su_home_t *home, 
00184                                                 sip_contact_t const *m);
00185 
00186 SOFIAPUBFUN int sip_contact_reject(sip_contact_t const *m, 
00187                                    sip_reject_contact_t const *rc);
00188 
00189 SOFIAPUBFUN int sip_contact_accept(sip_contact_t const *m, 
00190                                    sip_accept_contact_t const *cp,
00191                                    unsigned *return_S,
00192                                    unsigned *return_N,
00193                                    int *return_error);
00194 
00195 SOFIAPUBFUN int sip_contact_score(sip_contact_t const *m,
00196                                   sip_accept_contact_t const *ac,
00197                                   sip_reject_contact_t const *rc);
00198 
00199 
00200 SOFIAPUBFUN int sip_aor_strip(url_t *url);
00201 
00202 /* sec-agree utility functions. */
00203 
00204 SOFIAPUBFUN int sip_security_verify_compare(sip_security_server_t const *s,
00205                                             sip_security_verify_t const *v,
00206                                             char const **return_d_ver);
00207 
00208 SOFIAPUBFUN 
00209 sip_security_client_t const *
00210 sip_security_client_select(sip_security_client_t const *client,
00211                            sip_security_server_t const *server);
00212 
00213 SOFIA_END_DECLS
00214 
00215 #endif 

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