00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
00048
00049
00050
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
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
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
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