| File: | libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c |
| Location: | line 1119, column 29 |
| Description: | Value stored to 'dst' during its initialization is never read |
| 1 | /* |
| 2 | * This file is part of the Sofia-SIP package |
| 3 | * |
| 4 | * Copyright (C) 2006 Nokia Corporation. |
| 5 | * |
| 6 | * Contact: Pekka Pessi <pekka.pessi@nokia.com> |
| 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 | /**@CFILE nua_register.c |
| 26 | * @brief REGISTER and registrations |
| 27 | * |
| 28 | * @author Pekka Pessi <Pekka.Pessi@nokia.com> |
| 29 | * |
| 30 | * @date Created: Wed Mar 8 11:48:49 EET 2006 ppessi |
| 31 | */ |
| 32 | |
| 33 | #include "config.h" |
| 34 | |
| 35 | #include <sofia-sip/su_string.h> |
| 36 | #include <sofia-sip/su_strlst.h> |
| 37 | #include <sofia-sip/token64.h> |
| 38 | #include <sofia-sip/su_tagarg.h> |
| 39 | #include <sofia-sip/su_tag_inline.h> |
| 40 | |
| 41 | #include <sofia-sip/bnf.h> |
| 42 | |
| 43 | #include <sofia-sip/sip_protos.h> |
| 44 | #include <sofia-sip/sip_util.h> |
| 45 | #include <sofia-sip/sip_status.h> |
| 46 | #include <sofia-sip/msg_parser.h> |
| 47 | |
| 48 | #include "nua_stack.h" |
| 49 | |
| 50 | #include <stddef.h> |
| 51 | #include <stdlib.h> |
| 52 | #include <string.h> |
| 53 | #include <limits.h> |
| 54 | |
| 55 | #include <assert.h> |
| 56 | |
| 57 | /* ====================================================================== */ |
| 58 | /* Helper macros and functions for handling #nua_handle_preferences_t. */ |
| 59 | |
| 60 | #define NHP_IS_ANY_SET(nhp)nhp_is_any_set((nhp)) nhp_is_any_set((nhp)) |
| 61 | |
| 62 | /** Check if any preference is set in @a nhp. */ |
| 63 | su_inlinestatic inline int nhp_is_any_set(nua_handle_preferences_t const *nhp) |
| 64 | { |
| 65 | char nhp_zero[sizeof nhp->nhp_setnhp_set_.set_bits] = { 0 }; |
| 66 | return memcmp(&nhp->nhp_setnhp_set_.set_bits, nhp_zero, sizeof nhp->nhp_setnhp_set_.set_bits) != 0; |
| 67 | } |
| 68 | |
| 69 | /** Copy set parameters from @a b to @a a. |
| 70 | * |
| 71 | * If preference is set in @a b, mark it set also in @a a. |
| 72 | */ |
| 73 | su_inlinestatic inline void nhp_or_set(nua_handle_preferences_t *a, |
| 74 | nua_handle_preferences_t const *b) |
| 75 | { |
| 76 | memcpy(a, b, offsetof(nua_handle_preferences_t, nhp_set)__builtin_offsetof(nua_handle_preferences_t, nhp_set_.set_bits )); |
| 77 | |
| 78 | /* Bitwise or of bitfields, casted to unsigned */ |
| 79 | a->nhp_set_.set_unsigned[0] |= b->nhp_set_.set_unsigned[0]; |
| 80 | a->nhp_set_.set_unsigned[1] |= b->nhp_set_.set_unsigned[1]; |
| 81 | } |
| 82 | |
| 83 | static int nhp_set_tags(su_home_t *home, |
| 84 | nua_handle_preferences_t *nhp, |
| 85 | nua_global_preferences_t *ngp, |
| 86 | tagi_t const *tags); |
| 87 | |
| 88 | static int nhp_merge_lists(su_home_t *home, |
| 89 | msg_hclass_t *hc, |
| 90 | msg_list_t **return_new_list, |
| 91 | msg_list_t const *old_list, |
| 92 | int already_set, |
| 93 | int already_parsed, |
| 94 | int always_merge, |
| 95 | tag_value_t value); |
| 96 | |
| 97 | static int nhp_save_params(nua_handle_t *nh, |
| 98 | su_home_t *tmphome, |
| 99 | nua_global_preferences_t *gsrc, |
| 100 | nua_handle_preferences_t *src); |
| 101 | |
| 102 | /* ====================================================================== */ |
| 103 | /* Magical NUTAG_USER_AGENT() - add NHP_USER_AGENT there if it is not there */ |
| 104 | |
| 105 | #define NHP_USER_AGENT"sofia-sip" "/" "1.12.10devel" PACKAGE_NAME"sofia-sip" "/" PACKAGE_VERSION"1.12.10devel" |
| 106 | |
| 107 | static int already_contains_package_name(char const *s) |
| 108 | { |
| 109 | char const pn[] = " " PACKAGE_NAME"sofia-sip" "/"; |
| 110 | size_t pnlen = strlen(pn + 1); |
| 111 | |
| 112 | return su_casenmatch(s, pn + 1, pnlen) || su_strcasestr(s, pn); |
| 113 | } |
| 114 | |
| 115 | /* ====================================================================== */ |
| 116 | /* Stack and handle parameters */ |
| 117 | |
| 118 | static int nua_stack_set_smime_params(nua_t *nua, tagi_t const *tags); |
| 119 | |
| 120 | /** @internal Methods allowed by default. */ |
| 121 | static char const nua_allow_str[] = |
| 122 | "INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, " |
| 123 | "MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE"; |
| 124 | |
| 125 | /** @internal Set default parameters */ |
| 126 | int nua_stack_set_defaults(nua_handle_t *nh, |
| 127 | nua_handle_preferences_t *nhp) |
| 128 | { |
| 129 | su_home_t *home = (su_home_t *)nh; |
| 130 | |
| 131 | /* Set some defaults */ |
| 132 | NHP_SET(nhp, retry_count, 3)((nhp)->nhp_retry_count = (3), (nhp)->nhp_set_.set_bits .nhb_retry_count = 1); |
| 133 | NHP_SET(nhp, max_subscriptions, 20)((nhp)->nhp_max_subscriptions = (20), (nhp)->nhp_set_.set_bits .nhb_max_subscriptions = 1); |
| 134 | |
| 135 | NHP_SET(nhp, media_enable, 1)((nhp)->nhp_media_enable = (1), (nhp)->nhp_set_.set_bits .nhb_media_enable = 1); |
| 136 | NHP_SET(nhp, invite_enable, 1)((nhp)->nhp_invite_enable = (1), (nhp)->nhp_set_.set_bits .nhb_invite_enable = 1); |
| 137 | NHP_SET(nhp, auto_alert, 0)((nhp)->nhp_auto_alert = (0), (nhp)->nhp_set_.set_bits. nhb_auto_alert = 1); |
| 138 | NHP_SET(nhp, early_media, 0)((nhp)->nhp_early_media = (0), (nhp)->nhp_set_.set_bits .nhb_early_media = 1); |
| 139 | NHP_SET(nhp, only183_100rel, 0)((nhp)->nhp_only183_100rel = (0), (nhp)->nhp_set_.set_bits .nhb_only183_100rel = 1); |
| 140 | NHP_SET(nhp, auto_answer, 0)((nhp)->nhp_auto_answer = (0), (nhp)->nhp_set_.set_bits .nhb_auto_answer = 1); |
| 141 | NHP_SET(nhp, auto_ack, 1)((nhp)->nhp_auto_ack = (1), (nhp)->nhp_set_.set_bits.nhb_auto_ack = 1); |
| 142 | NHP_SET(nhp, timer_autorequire, 1)((nhp)->nhp_timer_autorequire = (1), (nhp)->nhp_set_.set_bits .nhb_timer_autorequire = 1); |
| 143 | NHP_SET(nhp, invite_timeout, 120)((nhp)->nhp_invite_timeout = (120), (nhp)->nhp_set_.set_bits .nhb_invite_timeout = 1); |
| 144 | |
| 145 | nhp->nhp_session_timer = 1800; |
| 146 | nhp->nhp_refresher = nua_no_refresher; |
| 147 | |
| 148 | NHP_SET(nhp, min_se, 120)((nhp)->nhp_min_se = (120), (nhp)->nhp_set_.set_bits.nhb_min_se = 1); |
| 149 | NHP_SET(nhp, update_refresh, 0)((nhp)->nhp_update_refresh = (0), (nhp)->nhp_set_.set_bits .nhb_update_refresh = 1); |
| 150 | |
| 151 | NHP_SET(nhp, message_enable, 1)((nhp)->nhp_message_enable = (1), (nhp)->nhp_set_.set_bits .nhb_message_enable = 1); |
| 152 | NHP_SET(nhp, win_messenger_enable, 0)((nhp)->nhp_win_messenger_enable = (0), (nhp)->nhp_set_ .set_bits.nhb_win_messenger_enable = 1); |
| 153 | if (getenv("PIMIW_HACK") != 0) |
| 154 | NHP_SET(nhp, message_auto_respond, 1)((nhp)->nhp_message_auto_respond = (1), (nhp)->nhp_set_ .set_bits.nhb_message_auto_respond = 1); |
| 155 | |
| 156 | NHP_SET(nhp, media_features, 0)((nhp)->nhp_media_features = (0), (nhp)->nhp_set_.set_bits .nhb_media_features = 1); |
| 157 | NHP_SET(nhp, callee_caps, 0)((nhp)->nhp_callee_caps = (0), (nhp)->nhp_set_.set_bits .nhb_callee_caps = 1); |
| 158 | NHP_SET(nhp, service_route_enable, 1)((nhp)->nhp_service_route_enable = (1), (nhp)->nhp_set_ .set_bits.nhb_service_route_enable = 1); |
| 159 | NHP_SET(nhp, path_enable, 1)((nhp)->nhp_path_enable = (1), (nhp)->nhp_set_.set_bits .nhb_path_enable = 1); |
| 160 | NHP_SET(nhp, retry_after_enable, 1)((nhp)->nhp_retry_after_enable = (1), (nhp)->nhp_set_.set_bits .nhb_retry_after_enable = 1); |
| 161 | |
| 162 | NHP_SET(nhp, refer_expires, 300)((nhp)->nhp_refer_expires = (300), (nhp)->nhp_set_.set_bits .nhb_refer_expires = 1); |
| 163 | NHP_SET(nhp, refer_with_id, 1)((nhp)->nhp_refer_with_id = (1), (nhp)->nhp_set_.set_bits .nhb_refer_with_id = 1); |
| 164 | |
| 165 | NHP_SET(nhp, substate, nua_substate_active)((nhp)->nhp_substate = (nua_substate_active), (nhp)->nhp_set_ .set_bits.nhb_substate = 1); |
| 166 | NHP_SET(nhp, sub_expires, 3600)((nhp)->nhp_sub_expires = (3600), (nhp)->nhp_set_.set_bits .nhb_sub_expires = 1); |
| 167 | |
| 168 | NHP_SET(nhp, allow, sip_allow_make(home, nua_allow_str))((nhp)->nhp_allow = (sip_allow_make(home, nua_allow_str)), (nhp)->nhp_set_.set_bits.nhb_allow = 1); |
| 169 | NHP_SET(nhp, supported, sip_supported_make(home, "timer, 100rel"))((nhp)->nhp_supported = (sip_supported_make(home, "timer, 100rel" )), (nhp)->nhp_set_.set_bits.nhb_supported = 1); |
| 170 | NHP_SET(nhp, user_agent, su_strdup(home, NHP_USER_AGENT))((nhp)->nhp_user_agent = (su_strdup(home, "sofia-sip" "/" "1.12.10devel" )), (nhp)->nhp_set_.set_bits.nhb_user_agent = 1); |
| 171 | |
| 172 | NHP_SET(nhp, outbound, su_strdup(home, "natify"))((nhp)->nhp_outbound = (su_strdup(home, "natify")), (nhp)-> nhp_set_.set_bits.nhb_outbound = 1); |
| 173 | |
| 174 | NHP_SET(nhp, keepalive, 120000)((nhp)->nhp_keepalive = (120000), (nhp)->nhp_set_.set_bits .nhb_keepalive = 1); |
| 175 | |
| 176 | NHP_SET(nhp, appl_method,((nhp)->nhp_appl_method = (sip_allow_make(home, "INVITE, REGISTER, PUBLISH, SUBSCRIBE" )), (nhp)->nhp_set_.set_bits.nhb_appl_method = 1) |
| 177 | sip_allow_make(home, "INVITE, REGISTER, PUBLISH, SUBSCRIBE"))((nhp)->nhp_appl_method = (sip_allow_make(home, "INVITE, REGISTER, PUBLISH, SUBSCRIBE" )), (nhp)->nhp_set_.set_bits.nhb_appl_method = 1); |
| 178 | |
| 179 | if (!nhp->nhp_allow || |
| 180 | !nhp->nhp_supported || |
| 181 | !nhp->nhp_user_agent || |
| 182 | !nhp->nhp_outbound) |
| 183 | return -1; |
| 184 | |
| 185 | return 0; |
| 186 | } |
| 187 | |
| 188 | /** @internal Set the default from field */ |
| 189 | int nua_stack_set_from(nua_t *nua, int initial, tagi_t const *tags) |
| 190 | { |
| 191 | sip_from_t const *from = NONE((void *)-1); |
| 192 | char const *str = NONE((void *)-1); |
| 193 | sip_from_t *f = NULL((void*)0), f0[1]; |
| 194 | int set; |
| 195 | |
| 196 | tl_gets(tags, |
| 197 | /* By nua_stack_set_from() */ |
| 198 | SIPTAG_FROM_REF(from)siptag_from_ref, siptag_from_vr(&(from)), |
| 199 | SIPTAG_FROM_STR_REF(str)siptag_from_str_ref, tag_str_vr(&(str)), |
| 200 | TAG_END()(tag_type_t)0, (tag_value_t)0); |
| 201 | |
| 202 | if (!initial && from == NONE((void *)-1) && str == NONE((void *)-1)) |
| 203 | return 0; |
| 204 | |
| 205 | sip_from_init(f0); |
| 206 | |
| 207 | if (from && from != NONE((void *)-1)) { |
| 208 | f0->a_display = from->a_display; |
| 209 | *f0->a_url = *from->a_url; |
| 210 | f = sip_from_dup(nua->nua_home, f0); |
| 211 | set = 1; |
| 212 | } |
| 213 | else if (str && str != NONE((void *)-1)) { |
| 214 | f = sip_from_make(nua->nua_home, str); |
| 215 | if (f) |
| 216 | *f0 = *f, f = f0, f->a_params = NULL((void*)0); |
| 217 | set = 1; |
| 218 | } |
| 219 | else { |
| 220 | sip_contact_t const *m; |
| 221 | |
| 222 | m = nua_stack_get_contact(nua->nua_registrations); |
| 223 | |
| 224 | if (m) { |
| 225 | f0->a_display = m->m_display; |
| 226 | *f0->a_url = *m->m_url; |
| 227 | f = sip_from_dup(nua->nua_home, f0); |
| 228 | } |
| 229 | set = 0; |
| 230 | } |
| 231 | |
| 232 | if (!f) |
| 233 | return -1; |
| 234 | |
| 235 | nua->nua_from_is_set = set; |
| 236 | *nua->nua_from = *f; |
| 237 | return 0; |
| 238 | } |
| 239 | |
| 240 | /** @internal Initialize instance ID. */ |
| 241 | int nua_stack_init_instance(nua_handle_t *nh, tagi_t const *tags) |
| 242 | { |
| 243 | nua_handle_preferences_t *nhp = nh->nh_prefs; |
| 244 | |
| 245 | char const *instance = NONE((void *)-1); |
| 246 | |
| 247 | tl_gets(tags, NUTAG_INSTANCE_REF(instance)nutag_instance_ref, tag_str_vr(&(instance)), TAG_END()(tag_type_t)0, (tag_value_t)0); |
| 248 | |
| 249 | if (instance != NONE((void *)-1)) { |
| 250 | NHP_SET(nhp, instance, su_strdup(nh->nh_home, instance))((nhp)->nhp_instance = (su_strdup(nh->nh_home, instance )), (nhp)->nhp_set_.set_bits.nhb_instance = 1); |
| 251 | if (instance && !nhp->nhp_instance) |
| 252 | return -1; |
| 253 | } |
| 254 | |
| 255 | return 0; |
| 256 | } |
| 257 | |
| 258 | /**@fn void nua_set_params(nua_t *nua, tag_type_t tag, tag_value_t value, ...) |
| 259 | * |
| 260 | * Set @nua parameters, shared by all handles. |
| 261 | * |
| 262 | * @param nua Pointer to NUA stack object |
| 263 | * @param tag, value, ... List of tagged parameters |
| 264 | * |
| 265 | * @return |
| 266 | * nothing |
| 267 | * |
| 268 | * @par Related tags: |
| 269 | * NUTAG_ALLOW(), SIPTAG_ALLOW(), and SIPTAG_ALLOW_STR() \n |
| 270 | * NUTAG_ALLOW_EVENTS(), SIPTAG_ALLOW_EVENTS(), and |
| 271 | * SIPTAG_ALLOW_EVENTS_STR() \n |
| 272 | * NUTAG_AUTOACK() \n |
| 273 | * NUTAG_AUTOALERT() \n |
| 274 | * NUTAG_AUTOANSWER() \n |
| 275 | * NUTAG_CALLEE_CAPS() \n |
| 276 | * NUTAG_DETECT_NETWORK_UPDATES() \n |
| 277 | * NUTAG_EARLY_ANSWER() \n |
| 278 | * NUTAG_EARLY_MEDIA() \n |
| 279 | * NUTAG_ENABLEINVITE() \n |
| 280 | * NUTAG_ENABLEMESSAGE() \n |
| 281 | * NUTAG_ENABLEMESSENGER() \n |
| 282 | * NUTAG_INITIAL_ROUTE() \n |
| 283 | * NUTAG_INITIAL_ROUTE_STR() \n |
| 284 | * NUTAG_INSTANCE() \n |
| 285 | * NUTAG_INVITE_TIMER() \n |
| 286 | * NUTAG_KEEPALIVE() \n |
| 287 | * NUTAG_KEEPALIVE_STREAM() \n |
| 288 | * NUTAG_MAX_SUBSCRIPTIONS() \n |
| 289 | * NUTAG_MEDIA_ENABLE() \n |
| 290 | * NUTAG_MEDIA_FEATURES() \n |
| 291 | * NUTAG_MIN_SE() \n |
| 292 | * NUTAG_M_DISPLAY() \n |
| 293 | * NUTAG_M_FEATURES() \n |
| 294 | * NUTAG_M_PARAMS() \n |
| 295 | * NUTAG_M_USERNAME() \n |
| 296 | * NUTAG_ONLY183_100REL() \n |
| 297 | * NUTAG_OUTBOUND() \n |
| 298 | * NUTAG_PATH_ENABLE() \n |
| 299 | * NUTAG_RETRY_AFTER_ENABLE() \n |
| 300 | * NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) \n |
| 301 | * NUTAG_REFER_EXPIRES() \n |
| 302 | * NUTAG_REFER_WITH_ID() \n |
| 303 | * NUTAG_REFRESH_WITHOUT_SDP() \n |
| 304 | * NUTAG_REGISTRAR() \n |
| 305 | * NUTAG_RETRY_COUNT() \n |
| 306 | * NUTAG_SERVICE_ROUTE_ENABLE() \n |
| 307 | * NUTAG_SESSION_REFRESHER() \n |
| 308 | * NUTAG_SESSION_TIMER() \n |
| 309 | * NUTAG_SMIME_ENABLE() \n |
| 310 | * NUTAG_SMIME_KEY_ENCRYPTION() \n |
| 311 | * NUTAG_SMIME_MESSAGE_DIGEST() \n |
| 312 | * NUTAG_SMIME_MESSAGE_ENCRYPTION() \n |
| 313 | * NUTAG_SMIME_OPT() \n |
| 314 | * NUTAG_SMIME_PROTECTION_MODE() \n |
| 315 | * NUTAG_SMIME_SIGNATURE() \n |
| 316 | * NUTAG_SOA_NAME() \n |
| 317 | * NUTAG_SUBSTATE() \n |
| 318 | * NUTAG_SUB_EXPIRES() \n |
| 319 | * NUTAG_SUPPORTED(), SIPTAG_SUPPORTED(), and SIPTAG_SUPPORTED_STR() \n |
| 320 | * NUTAG_UPDATE_REFRESH() \n |
| 321 | * NUTAG_USER_AGENT(), SIPTAG_USER_AGENT() and SIPTAG_USER_AGENT_STR() \n |
| 322 | * SIPTAG_ORGANIZATION() and SIPTAG_ORGANIZATION_STR() \n |
| 323 | * |
| 324 | * nua_set_params() also accepts any soa tags, defined in |
| 325 | * <sofia-sip/soa_tag.h>, and nta tags, defined in <sofia-sip/nta_tag.h>. |
| 326 | * |
| 327 | * @par Events: |
| 328 | * #nua_r_set_params |
| 329 | * |
| 330 | * @par SIP Header as NUA Parameters |
| 331 | * The @nua parameters include SIP headers @Allow, @Supported, @Organization, |
| 332 | * @UserAgent and @From. They are included in most of the SIP messages sent |
| 333 | * by @nua. They are set in the same way as the tagged arguments are |
| 334 | * used to populate a SIP message. |
| 335 | * @par |
| 336 | * When multiple tags for the same header are specified, the behaviour |
| 337 | * depends on the header type. If only a single header field can be included |
| 338 | * in a SIP message, the latest non-NULL value is used, e.g., @Organization. |
| 339 | * However, if the SIP header can consist of multiple lines or header fields |
| 340 | * separated by comma, in this case, @Allow and @Supported, all the tagged |
| 341 | * values are concatenated. |
| 342 | * @par |
| 343 | * However, if the tag value is #SIP_NONE (-1 casted as a void pointer), the |
| 344 | * values from previous tags are ignored. |
| 345 | * |
| 346 | * For example, the nua_set_params() call like this: |
| 347 | * @code |
| 348 | * nua_set_params(nua, |
| 349 | * SIPTAG_USER_AGENT_STR("tester/1.0"), |
| 350 | * SIPTAG_ALLOW_STR("INVITE,CANCEL,BYE,ACK"), |
| 351 | * SIPTAG_ORGANIZATION(NULL), |
| 352 | * SIPTAG_USER_AGENT(NULL), |
| 353 | * SIPTAG_ALLOW(SIP_NONE), |
| 354 | * TAG_END()); |
| 355 | * @endcode |
| 356 | * will leave @Allow and @Organization headers empty. The @UserAgent header |
| 357 | * will contain value "tester/1.0". |
| 358 | * @code |
| 359 | * nua_set_params(nua, |
| 360 | * SIPTAG_ORGANIZATION_STR("Malevolent Microwavers"), |
| 361 | * SIPTAG_ALLOW_STR("OPTIONS"), |
| 362 | * SIPTAG_ALLOW(SIP_NONE), |
| 363 | * SIPTAG_ORGANIZATION_STR("The Phone Company"), |
| 364 | * SIPTAG_ALLOW_STR("SUBSCRIBE"), |
| 365 | * SIPTAG_ALLOW(NULL), |
| 366 | * SIPTAG_ORGANIZATION_STR(NULL), |
| 367 | * TAG_END()); |
| 368 | * @endcode |
| 369 | * sets the header @Allow with value <code>SUBSCRIBE</code> and the |
| 370 | * header @Organization will have value <code>The Phone Company</code>. |
| 371 | * |
| 372 | */ |
| 373 | |
| 374 | /**@fn void nua_set_hparams(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...); |
| 375 | * |
| 376 | * Set the handle-specific parameters. |
| 377 | * |
| 378 | * The handle-specific parameters override default or global parameters set |
| 379 | * by nua_set_params(). The handle-specific parameters are set by several |
| 380 | * other operations: nua_invite(), nua_respond(), nua_ack(), |
| 381 | * nua_prack(), nua_update(), nua_info(), nua_bye(), nua_options(), |
| 382 | * nua_message(), nua_register(), nua_publish(), nua_refer(), |
| 383 | * nua_subscribe(), nua_notify(), nua_refer(), and nua_notifier(). |
| 384 | * |
| 385 | * @param nh Pointer to a NUA handle |
| 386 | * @param tag, value, ... List of tagged parameters |
| 387 | * |
| 388 | * @return |
| 389 | * nothing |
| 390 | * |
| 391 | * @par Tags Used to Set Handle-Specific Parameters: |
| 392 | * NUTAG_ALLOW(), SIPTAG_ALLOW(), and SIPTAG_ALLOW_STR() \n |
| 393 | * NUTAG_ALLOW_EVENTS(), SIPTAG_ALLOW_EVENTS(), and |
| 394 | * SIPTAG_ALLOW_EVENTS_STR() \n |
| 395 | * NUTAG_AUTH_CACHE() \n |
| 396 | * NUTAG_AUTOACK() \n |
| 397 | * NUTAG_AUTOALERT() \n |
| 398 | * NUTAG_AUTOANSWER() \n |
| 399 | * NUTAG_CALLEE_CAPS() \n |
| 400 | * NUTAG_EARLY_ANSWER() \n |
| 401 | * NUTAG_EARLY_MEDIA() \n |
| 402 | * NUTAG_ENABLEINVITE() \n |
| 403 | * NUTAG_ENABLEMESSAGE() \n |
| 404 | * NUTAG_ENABLEMESSENGER() \n |
| 405 | * NUTAG_INITIAL_ROUTE() \n |
| 406 | * NUTAG_INITIAL_ROUTE_STR() \n |
| 407 | * NUTAG_INSTANCE() \n |
| 408 | * NUTAG_INVITE_TIMER() \n |
| 409 | * NUTAG_KEEPALIVE() \n |
| 410 | * NUTAG_KEEPALIVE_STREAM() \n |
| 411 | * NUTAG_MAX_SUBSCRIPTIONS() \n |
| 412 | * NUTAG_MEDIA_ENABLE() \n |
| 413 | * NUTAG_MEDIA_FEATURES() \n |
| 414 | * NUTAG_MIN_SE() \n |
| 415 | * NUTAG_M_DISPLAY() \n |
| 416 | * NUTAG_M_FEATURES() \n |
| 417 | * NUTAG_M_PARAMS() \n |
| 418 | * NUTAG_M_USERNAME() \n |
| 419 | * NUTAG_ONLY183_100REL() \n |
| 420 | * NUTAG_OUTBOUND() \n |
| 421 | * NUTAG_PATH_ENABLE() \n |
| 422 | * NUTAG_RETRY_AFTER_ENABLE() \n |
| 423 | * NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) \n |
| 424 | * NUTAG_REFER_EXPIRES() \n |
| 425 | * NUTAG_REFER_WITH_ID() \n |
| 426 | * NUTAG_REFRESH_WITHOUT_SDP() \n |
| 427 | * NUTAG_REGISTRAR() \n |
| 428 | * NUTAG_RETRY_COUNT() \n |
| 429 | * NUTAG_SERVICE_ROUTE_ENABLE() \n |
| 430 | * NUTAG_SESSION_REFRESHER() \n |
| 431 | * NUTAG_SESSION_TIMER() \n |
| 432 | * NUTAG_SOA_NAME() \n |
| 433 | * NUTAG_SUBSTATE() \n |
| 434 | * NUTAG_SUB_EXPIRES() \n |
| 435 | * NUTAG_SUPPORTED(), SIPTAG_SUPPORTED(), and SIPTAG_SUPPORTED_STR() \n |
| 436 | * NUTAG_UPDATE_REFRESH() \n |
| 437 | * NUTAG_USER_AGENT(), SIPTAG_USER_AGENT() and SIPTAG_USER_AGENT_STR() \n |
| 438 | * SIPTAG_ORGANIZATION() and SIPTAG_ORGANIZATION_STR() \n |
| 439 | * Any soa tags are also considered as handle-specific parameters. They are |
| 440 | * defined in <sofia-sip/soa_tag.h>. |
| 441 | * |
| 442 | * The global parameters that can not be set by nua_set_hparams() include |
| 443 | * NUTAG_DETECT_NETWORK_UPDATES(), NUTAG_SMIME_* tags, and all NTA tags. |
| 444 | * |
| 445 | * @par Events: |
| 446 | * #nua_r_set_params |
| 447 | */ |
| 448 | |
| 449 | /** @NUA_EVENT nua_r_set_params |
| 450 | * |
| 451 | * Response to nua_set_params() or nua_set_hparams(). |
| 452 | * |
| 453 | * @param status 200 when successful, error code otherwise |
| 454 | * @param phrase a short textual description of @a status code |
| 455 | * @param nh NULL when responding to nua_set_params(), |
| 456 | * operation handle when responding to nua_set_hparams() |
| 457 | * @param hmagic NULL when responding to nua_set_params(), |
| 458 | * application contact associated with the operation handle |
| 459 | * when responding to nua_set_hparams() |
| 460 | * @param sip NULL |
| 461 | * @param tags None |
| 462 | * |
| 463 | * @sa nua_set_params(), nua_set_hparams(), |
| 464 | * #nua_r_get_params, nua_get_params(), nua_get_hparams() |
| 465 | * |
| 466 | * @END_NUA_EVENT |
| 467 | */ |
| 468 | |
| 469 | int nua_stack_set_params(nua_t *nua, nua_handle_t *nh, nua_event_t e, |
| 470 | tagi_t const *tags) |
| 471 | { |
| 472 | nua_handle_t *dnh = nua->nua_dhandlenua_handles; |
| 473 | |
| 474 | int status; |
| 475 | char const *phrase; |
| 476 | |
| 477 | nua_handle_preferences_t tmp[1]; |
| 478 | int any_changes = 0; |
| 479 | |
| 480 | enter(void)((((nua_log) != ((void*)0) && (nua_log)->log_init ) == 0 ? 9 : (((nua_log) != ((void*)0) && (nua_log)-> log_init > 1) ? (nua_log)->log_level : su_log_default-> log_level)) >= 9 ? (_su_llog((nua_log), 9, "nua_params.c", (const char *)__func__, 480, "nua: %s: entering\n", __func__ )) : (void)0); |
| 481 | |
| 482 | { |
| 483 | su_home_t tmphome[1] = { SU_HOME_INIT(tmphome){ 0, ((void*)0), ((void*)0) } }; |
| 484 | nua_handle_preferences_t *nhp = nh->nh_prefs; |
| 485 | nua_handle_preferences_t const *dnhp = dnh->nh_prefs; |
| 486 | nua_global_preferences_t gtmp[1], *ngp = NULL((void*)0); |
| 487 | |
| 488 | *tmp = *nhp; NHP_UNSET_ALL(tmp)(memset(&(tmp)->nhp_set_.set_bits, 0, sizeof (tmp)-> nhp_set_.set_bits)); |
| 489 | |
| 490 | /* |
| 491 | * Supported features, allowed methods and events are merged |
| 492 | * with previous or default settings. |
| 493 | * |
| 494 | * Here we just copy pointers from default settings. However when saving |
| 495 | * settings we have to be extra careful so that we |
| 496 | * 1) zero the pointers if the setting has not been modified |
| 497 | * 2) do not free pointer if the setting has been modified |
| 498 | * See NHP_ZAP_OVERRIDEN() below for gorier details. |
| 499 | */ |
| 500 | if (!NHP_ISSET(nhp, supported)((nhp)->nhp_set_.set_bits.nhb_supported)) |
| 501 | tmp->nhp_supported = dnhp->nhp_supported; |
| 502 | if (!NHP_ISSET(nhp, allow)((nhp)->nhp_set_.set_bits.nhb_allow)) |
| 503 | tmp->nhp_allow = dnhp->nhp_allow; |
| 504 | if (!NHP_ISSET(nhp, allow_events)((nhp)->nhp_set_.set_bits.nhb_allow_events)) |
| 505 | tmp->nhp_allow_events = dnhp->nhp_allow_events; |
| 506 | if (!NHP_ISSET(nhp, appl_method)((nhp)->nhp_set_.set_bits.nhb_appl_method)) |
| 507 | tmp->nhp_appl_method = dnhp->nhp_appl_method; |
| 508 | |
| 509 | if (nh == dnh) /* nua_set_params() call, save stack-wide params, too */ |
| 510 | ngp = gtmp, *gtmp = *nua->nua_prefs; |
| 511 | |
| 512 | /* Set and save parameters to tmp */ |
| 513 | if (!nh->nh_used_ptags && |
| 514 | nhp_set_tags(tmphome, tmp, NULL((void*)0), nh->nh_ptags) < 0) |
| 515 | status = 900, phrase = "Error storing default handle parameters"; |
| 516 | else if (nhp_set_tags(tmphome, tmp, ngp, tags) < 0) |
| 517 | status = 900, phrase = "Error storing parameters"; |
| 518 | else if ((any_changes = nhp_save_params(nh, tmphome, ngp, tmp)) < 0) |
| 519 | status = 900, phrase = su_strerror(ENOMEM12); |
| 520 | else |
| 521 | status = 200, phrase = "OK", nh->nh_used_ptags = 1; |
| 522 | |
| 523 | su_home_deinit(tmphome); |
| 524 | } |
| 525 | |
| 526 | if (status == 200) { |
| 527 | nua_handle_preferences_t const *nhp = nh->nh_prefs; |
| 528 | nua_handle_preferences_t const *dnhp = dnh->nh_prefs; |
| 529 | |
| 530 | if (!nh->nh_soa && NHP_GET(nhp, dnhp, media_enable)((nhp)->nhp_set_.set_bits.nhb_media_enable ? (nhp)->nhp_media_enable : (dnhp)->nhp_media_enable)) { |
| 531 | /* Create soa when needed */ |
| 532 | char const *soa_name = NHP_GET(nhp, dnhp, soa_name)((nhp)->nhp_set_.set_bits.nhb_soa_name ? (nhp)->nhp_soa_name : (dnhp)->nhp_soa_name); |
| 533 | |
| 534 | if (dnh->nh_soa) |
| 535 | nh->nh_soa = soa_clone(dnh->nh_soa, nua->nua_root, nh); |
| 536 | else |
| 537 | nh->nh_soa = soa_create(soa_name, nua->nua_root, nh); |
| 538 | |
| 539 | if (!nh->nh_soa) |
| 540 | status = 900, phrase = "Error Creating SOA Object"; |
| 541 | else if (soa_set_params(nh->nh_soa, TAG_NEXT(nh->nh_ptags)tag_next, (tag_value_t)(nh->nh_ptags)) < 0) |
| 542 | status = 900, phrase = "Error Setting SOA Parameters"; |
| 543 | } |
| 544 | else if (nh->nh_soa && !NHP_GET(nhp, dnhp, media_enable)((nhp)->nhp_set_.set_bits.nhb_media_enable ? (nhp)->nhp_media_enable : (dnhp)->nhp_media_enable)) { |
| 545 | /* ... destroy soa when not needed */ |
| 546 | soa_destroy(nh->nh_soa), nh->nh_soa = NULL((void*)0); |
| 547 | } |
| 548 | |
| 549 | if (status == 200 && tags && nh->nh_soa && |
| 550 | soa_set_params(nh->nh_soa, TAG_NEXT(tags)tag_next, (tag_value_t)(tags)) < 0) |
| 551 | status = 900, phrase = "Error Setting SOA Parameters"; |
| 552 | } |
| 553 | |
| 554 | if (status == 200 && nh == dnh) { |
| 555 | /* Set stack-specific things below */ |
| 556 | if (nua_stack_set_smime_params(nua, tags) < 0) { |
| 557 | status = 900, phrase = "Error setting S/MIME parameters"; |
| 558 | } |
| 559 | else if (nua->nua_nta && |
| 560 | nta_agent_set_params(nua->nua_nta, TAG_NEXT(tags)tag_next, (tag_value_t)(tags)) < 0) { |
| 561 | status = 900, phrase = "Error setting NTA parameters"; |
| 562 | } |
| 563 | else { |
| 564 | nua_stack_set_from(nua, 0, tags); |
| 565 | |
| 566 | if (nua->nua_prefs->ngp_detect_network_updates) |
| 567 | nua_stack_launch_network_change_detector(nua); |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | if (status != 200) { |
| 572 | if (e == nua_i_none) |
| 573 | SU_DEBUG_1(("nua_set_params(): failed: %s\n", phrase))((((nua_log) != ((void*)0) && (nua_log)->log_init) == 0 ? 9 : (((nua_log) != ((void*)0) && (nua_log)-> log_init > 1) ? (nua_log)->log_level : su_log_default-> log_level)) >= 1 ? (_su_llog((nua_log), 1, "nua_params.c", (const char *)__func__, 573, "nua_set_params(): failed: %s\n" , phrase)) : (void)0); |
| 574 | return UA_EVENT2(e, status, phrase)nua_stack_event(nua, nh, ((void*)0), e, status, phrase, ((void *)0)), -1; |
| 575 | } |
| 576 | else { |
| 577 | if (e == nua_r_set_params) |
| 578 | UA_EVENT2(e, status, phrase)nua_stack_event(nua, nh, ((void*)0), e, status, phrase, ((void *)0)); |
| 579 | |
| 580 | if (any_changes) { |
| 581 | nua_handle_preferences_t changed[1]; |
| 582 | |
| 583 | *changed = *nh->nh_prefs; |
| 584 | memcpy(&changed->nhp_set_, &tmp->nhp_set_, sizeof changed->nhp_set_); |
| 585 | |
| 586 | nua_dialog_update_params(nh->nh_ds, |
| 587 | changed, |
| 588 | nh->nh_prefs, |
| 589 | dnh->nh_prefs); |
| 590 | } |
| 591 | return 0; |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | |
| 596 | /** Parse parameters from tags to @a nhp or @a ngp. |
| 597 | * |
| 598 | * @param home allocate new values from @a home |
| 599 | * @param nhp structure to store handle preferences |
| 600 | * @param ngp structure to store global preferences |
| 601 | * @param tags list of tags to parse |
| 602 | */ |
| 603 | static int nhp_set_tags(su_home_t *home, |
| 604 | nua_handle_preferences_t *nhp, |
| 605 | nua_global_preferences_t *ngp, |
| 606 | tagi_t const *tags) |
| 607 | { |
| 608 | |
| 609 | /* Set copy of string to handle pref structure */ |
| 610 | #define NHP_SET_STR(nhp, name, v)if ((v) != (tag_value_t)0) { char const *_value = (char const *)v; char *_new = _value ? su_strdup(home, _value) : ((void* )0); if (((nhp)->nhp_set_.set_bits.nhb_name)) su_free(home , (void *)nhp->nhp_name); ((nhp)->nhp_name = (_new), (nhp )->nhp_set_.set_bits.nhb_name = 1); if (_new == ((void*)0) && _value != ((void*)0)) return -1; } \ |
| 611 | if ((v) != (tag_value_t)0) { \ |
| 612 | char const *_value = (char const *)v; \ |
| 613 | char *_new = _value ? su_strdup(home, _value) : NULL((void*)0); \ |
| 614 | if (NHP_ISSET(nhp, name)((nhp)->nhp_set_.set_bits.nhb_name)) \ |
| 615 | su_free(home, (void *)nhp->nhp_##name); \ |
| 616 | NHP_SET(nhp, name, _new)((nhp)->nhp_name = (_new), (nhp)->nhp_set_.set_bits.nhb_name = 1); \ |
| 617 | if (_new == NULL((void*)0) && _value != NULL((void*)0)) \ |
| 618 | return -1; \ |
| 619 | } |
| 620 | |
| 621 | /* Set copy of string from url to handle pref structure */ |
| 622 | #define NHP_SET_STR_BY_URL(nhp, type, name, v)if ((v) != (tag_value_t)-1) { url_t const *_value = (url_t const *)(v); type *_new = (type *)url_as_string(home, (void *)_value ); if (((nhp)->nhp_set_.set_bits.nhb_name)) su_free(home, ( void *)nhp->nhp_name); ((nhp)->nhp_name = (_new), (nhp) ->nhp_set_.set_bits.nhb_name = 1); if (_new == ((void*)0) && _value != ((void*)0)) return -1; } \ |
| 623 | if ((v) != (tag_value_t)-1) { \ |
| 624 | url_t const *_value = (url_t const *)(v); \ |
| 625 | type *_new = (type *)url_as_string(home, (void *)_value); \ |
| 626 | if (NHP_ISSET(nhp, name)((nhp)->nhp_set_.set_bits.nhb_name)) \ |
| 627 | su_free(home, (void *)nhp->nhp_##name); \ |
| 628 | NHP_SET(nhp, name, _new)((nhp)->nhp_name = (_new), (nhp)->nhp_set_.set_bits.nhb_name = 1); \ |
| 629 | if (_new == NULL((void*)0) && _value != NULL((void*)0)) \ |
| 630 | return -1; \ |
| 631 | } |
| 632 | |
| 633 | /* Set copy of header to handle pref structure */ |
| 634 | #define NHP_SET_HEADER(nhp, name, hdr, v)if ((v) != 0) { sip_hdr_t const *_value = (sip_hdr_t const *) (v); sip_hdr_t *_new = ((void*)0); if (_value != ((void const *)-1L)) _new = sip_name_dup(home, _value); if (((nhp)->nhp_set_ .set_bits.nhb_name)) msg_header_free_all(home, (void *)nhp-> nhp_name); ((nhp)->nhp_name = (_new), (nhp)->nhp_set_.set_bits .nhb_name = 1); if (_new == ((void*)0) && _value != ( (void const *)-1L)) return -1; } \ |
| 635 | if ((v) != 0) { \ |
| 636 | sip_##hdr##_t const *_value = (sip_##hdr##_t const *)(v); \ |
| 637 | sip_##hdr##_t *_new = NULL((void*)0); \ |
| 638 | if (_value != SIP_NONE((void const *)-1L)) \ |
| 639 | _new = sip_##name##_dup(home, _value); \ |
| 640 | if (NHP_ISSET(nhp, name)((nhp)->nhp_set_.set_bits.nhb_name)) \ |
| 641 | msg_header_free_all(home, (void *)nhp->nhp_##name); \ |
| 642 | NHP_SET(nhp, name, _new)((nhp)->nhp_name = (_new), (nhp)->nhp_set_.set_bits.nhb_name = 1); \ |
| 643 | if (_new == NULL((void*)0) && _value != SIP_NONE((void const *)-1L)) \ |
| 644 | return -1; \ |
| 645 | } |
| 646 | |
| 647 | /* Set header made of string to handle pref structure */ |
| 648 | #define NHP_SET_HEADER_STR(nhp, name, hdr, v)if ((v) != 0) { char const *_value = (char const *)(v); sip_hdr_t *_new = ((void*)0); if (_value != ((void const *)-1L)) _new = sip_name_make(home, _value); if (((nhp)->nhp_set_.set_bits .nhb_name)) msg_header_free_all(home, (void *)nhp->nhp_name ); ((nhp)->nhp_name = (_new), (nhp)->nhp_set_.set_bits. nhb_name = 1); if (_new == ((void*)0) && _value != (( void const *)-1L)) return -1; } \ |
| 649 | if ((v) != 0) { \ |
| 650 | char const *_value = (char const *)(v); \ |
| 651 | sip_##hdr##_t *_new = NULL((void*)0); \ |
| 652 | if (_value != SIP_NONE((void const *)-1L)) \ |
| 653 | _new = sip_##name##_make(home, _value); \ |
| 654 | if (NHP_ISSET(nhp, name)((nhp)->nhp_set_.set_bits.nhb_name)) \ |
| 655 | msg_header_free_all(home, (void *)nhp->nhp_##name); \ |
| 656 | NHP_SET(nhp, name, _new)((nhp)->nhp_name = (_new), (nhp)->nhp_set_.set_bits.nhb_name = 1); \ |
| 657 | if (_new == NULL((void*)0) && _value != SIP_NONE((void const *)-1L)) \ |
| 658 | return -1; \ |
| 659 | } |
| 660 | |
| 661 | /* Append copy of header to handle pref structure */ |
| 662 | #define NHP_APPEND_HEADER(nhp, name, hdr, is_str, next, v){ sip_hdr_t const *_value = (sip_hdr_t const *)(v); char const *_str = (char const *)(v); sip_hdr_t *_new = ((void*)0); sip_hdr_t **_end = &nhp->nhp_name; if (_value != ((void const * )-1L) && _value != ((void*)0)) { _new = (is_str) ? sip_hdr_make (home, _str) : sip_hdr_dup(home, _value); if (_new == ((void* )0)) return -1; } if (((nhp)->nhp_set_.set_bits.nhb_name)) while(*_end) _end = next(*_end); nhp->nhp_set_.set_bits.nhb_name = 1; *_end = _new; } \ |
| 663 | { \ |
| 664 | sip_##hdr##_t const *_value = (sip_##hdr##_t const *)(v); \ |
| 665 | char const *_str = (char const *)(v); \ |
| 666 | sip_##hdr##_t *_new = NULL((void*)0); \ |
| 667 | sip_##hdr##_t **_end = &nhp->nhp_##name; \ |
| 668 | if (_value != SIP_NONE((void const *)-1L) && _value != NULL((void*)0)) { \ |
| 669 | _new = (is_str) \ |
| 670 | ? sip_##hdr##_make(home, _str) \ |
| 671 | : sip_##hdr##_dup(home, _value); \ |
| 672 | if (_new == NULL((void*)0)) return -1; \ |
| 673 | } \ |
| 674 | if (NHP_ISSET(nhp, name)((nhp)->nhp_set_.set_bits.nhb_name)) \ |
| 675 | while(*_end) \ |
| 676 | _end = next(*_end); \ |
| 677 | nhp->nhp_setnhp_set_.set_bits.nhb_##name = 1; \ |
| 678 | *_end = _new; \ |
| 679 | } |
| 680 | |
| 681 | /* Set copy of string from header to handle pref structure */ |
| 682 | #define NHP_SET_STR_BY_HEADER(nhp, name, v)if ((v) != 0) { sip_name_t const *_value = (sip_name_t const * )(v); char *_new = ((void*)0); if (_value != ((void const *)- 1L)) _new = sip_header_as_string(home, (void *)_value); if (( (nhp)->nhp_set_.set_bits.nhb_name)) su_free(home, (void *) nhp->nhp_name); ((nhp)->nhp_name = (_new), (nhp)->nhp_set_ .set_bits.nhb_name = 1); if (_new == ((void*)0) && _value != ((void const *)-1L)) return -1; } \ |
| 683 | if ((v) != 0) { \ |
| 684 | sip_##name##_t const *_value = (sip_##name##_t const *)(v); \ |
| 685 | char *_new = NULL((void*)0); \ |
| 686 | if (_value != SIP_NONE((void const *)-1L)) \ |
| 687 | _new = sip_header_as_string(home, (void *)_value); \ |
| 688 | if (NHP_ISSET(nhp, name)((nhp)->nhp_set_.set_bits.nhb_name)) \ |
| 689 | su_free(home, (void *)nhp->nhp_##name); \ |
| 690 | NHP_SET(nhp, name, _new)((nhp)->nhp_name = (_new), (nhp)->nhp_set_.set_bits.nhb_name = 1); \ |
| 691 | if (_new == NULL((void*)0) && _value != SIP_NONE((void const *)-1L)) \ |
| 692 | return -1; \ |
| 693 | } |
| 694 | |
| 695 | |
| 696 | tagi_t const *t; |
| 697 | |
| 698 | for (t = tags; t; t = tl_next(t)) { |
| 699 | tag_type_t tag = t->t_tag; |
| 700 | tag_value_t value = t->t_value; |
| 701 | |
| 702 | if (tag == NULL((void*)0)) |
| 703 | break; |
| 704 | /* NUTAG_RETRY_COUNT(retry_count) */ |
| 705 | else if (tag == nutag_retry_count) { |
| 706 | NHP_SET(nhp, retry_count, (unsigned)value)((nhp)->nhp_retry_count = ((unsigned)value), (nhp)->nhp_set_ .set_bits.nhb_retry_count = 1); |
| 707 | } |
| 708 | /* NUTAG_MAX_SUBSCRIPTIONS(max_subscriptions) */ |
| 709 | else if (tag == nutag_max_subscriptions) { |
| 710 | NHP_SET(nhp, max_subscriptions, (unsigned)value)((nhp)->nhp_max_subscriptions = ((unsigned)value), (nhp)-> nhp_set_.set_bits.nhb_max_subscriptions = 1); |
| 711 | } |
| 712 | /* NUTAG_SOA_NAME(soa_name) */ |
| 713 | else if (tag == nutag_soa_name) { |
| 714 | NHP_SET_STR(nhp, soa_name, value)if ((value) != (tag_value_t)0) { char const *_value = (char const *)value; char *_new = _value ? su_strdup(home, _value) : ((void *)0); if (((nhp)->nhp_set_.set_bits.nhb_soa_name)) su_free (home, (void *)nhp->nhp_soa_name); ((nhp)->nhp_soa_name = (_new), (nhp)->nhp_set_.set_bits.nhb_soa_name = 1); if ( _new == ((void*)0) && _value != ((void*)0)) return -1 ; }; |
| 715 | } |
| 716 | /* NUTAG_MEDIA_ENABLE(media_enable) */ |
| 717 | else if (tag == nutag_media_enable) { |
| 718 | NHP_SET(nhp, media_enable, value != 0)((nhp)->nhp_media_enable = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_media_enable = 1); |
| 719 | } |
| 720 | /* NUTAG_ENABLEINVITE(invite_enable) */ |
| 721 | else if (tag == nutag_enableinvite) { |
| 722 | NHP_SET(nhp, invite_enable, value != 0)((nhp)->nhp_invite_enable = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_invite_enable = 1); |
| 723 | } |
| 724 | /* NUTAG_AUTOALERT(auto_alert) */ |
| 725 | else if (tag == nutag_autoalert) { |
| 726 | NHP_SET(nhp, auto_alert, value != 0)((nhp)->nhp_auto_alert = (value != 0), (nhp)->nhp_set_. set_bits.nhb_auto_alert = 1); |
| 727 | } |
| 728 | /* NUTAG_EARLY_ANSWER(early_answer) */ |
| 729 | else if (tag == nutag_early_answer) { |
| 730 | NHP_SET(nhp, early_answer, value != 0)((nhp)->nhp_early_answer = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_early_answer = 1); |
| 731 | } |
| 732 | /* NUTAG_EARLY_MEDIA(early_media) */ |
| 733 | else if (tag == nutag_early_media) { |
| 734 | NHP_SET(nhp, early_media, value != 0)((nhp)->nhp_early_media = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_early_media = 1); |
| 735 | } |
| 736 | /* NUTAG_ONLY183_100REL(only183_100rel) */ |
| 737 | else if (tag == nutag_only183_100rel) { |
| 738 | NHP_SET(nhp, only183_100rel, value != 0)((nhp)->nhp_only183_100rel = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_only183_100rel = 1); |
| 739 | } |
| 740 | /* NUTAG_AUTOANSWER(auto_answer) */ |
| 741 | else if (tag == nutag_autoanswer) { |
| 742 | NHP_SET(nhp, auto_answer, value != 0)((nhp)->nhp_auto_answer = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_auto_answer = 1); |
| 743 | } |
| 744 | /* NUTAG_AUTOACK(auto_ack) */ |
| 745 | else if (tag == nutag_autoack) { |
| 746 | NHP_SET(nhp, auto_ack, value != 0)((nhp)->nhp_auto_ack = (value != 0), (nhp)->nhp_set_.set_bits .nhb_auto_ack = 1); |
| 747 | } |
| 748 | /* NUTAG_TIMER_AUTOREQUIRE(timer_autorequire) */ |
| 749 | else if (tag == nutag_timer_autorequire) { |
| 750 | NHP_SET(nhp, timer_autorequire, value != 0)((nhp)->nhp_timer_autorequire = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_timer_autorequire = 1); |
| 751 | } |
| 752 | /* NUTAG_INVITE_TIMER(invite_timeout) */ |
| 753 | else if (tag == nutag_invite_timer) { |
| 754 | NHP_SET(nhp, invite_timeout, (unsigned)value)((nhp)->nhp_invite_timeout = ((unsigned)value), (nhp)-> nhp_set_.set_bits.nhb_invite_timeout = 1); |
| 755 | } |
| 756 | /* NUTAG_SESSION_TIMER(session_timer) */ |
| 757 | else if (tag == nutag_session_timer) { |
| 758 | NHP_SET(nhp, session_timer, (unsigned)value)((nhp)->nhp_session_timer = ((unsigned)value), (nhp)->nhp_set_ .set_bits.nhb_session_timer = 1); |
| 759 | } |
| 760 | /* NUTAG_MIN_SE(min_se) */ |
| 761 | else if (tag == nutag_min_se) { |
| 762 | NHP_SET(nhp, min_se, (unsigned)value)((nhp)->nhp_min_se = ((unsigned)value), (nhp)->nhp_set_ .set_bits.nhb_min_se = 1); |
| 763 | } |
| 764 | /* NUTAG_SESSION_REFRESHER(refresher) */ |
| 765 | else if (tag == nutag_session_refresher) { |
| 766 | int refresher = value; |
| 767 | |
| 768 | if (refresher >= nua_remote_refresher) |
| 769 | refresher = nua_remote_refresher; |
| 770 | else if (refresher <= nua_no_refresher) |
| 771 | refresher = nua_no_refresher; |
| 772 | |
| 773 | NHP_SET(nhp, refresher, (enum nua_session_refresher)refresher)((nhp)->nhp_refresher = ((enum nua_session_refresher)refresher ), (nhp)->nhp_set_.set_bits.nhb_refresher = 1); |
| 774 | } |
| 775 | /* NUTAG_UPDATE_REFRESH(update_refresh) */ |
| 776 | else if (tag == nutag_update_refresh) { |
| 777 | NHP_SET(nhp, update_refresh, value != 0)((nhp)->nhp_update_refresh = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_update_refresh = 1); |
| 778 | } |
| 779 | /* NUTAG_REFRESH_WITHOUT_SDP(refresh_without_sdp) */ |
| 780 | else if (tag == nutag_refresh_without_sdp) { |
| 781 | NHP_SET(nhp, refresh_without_sdp, value != 0)((nhp)->nhp_refresh_without_sdp = (value != 0), (nhp)-> nhp_set_.set_bits.nhb_refresh_without_sdp = 1); |
| 782 | } |
| 783 | /* NUTAG_ENABLEMESSAGE(message_enable) */ |
| 784 | else if (tag == nutag_enablemessage) { |
| 785 | NHP_SET(nhp, message_enable, value != 0)((nhp)->nhp_message_enable = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_message_enable = 1); |
| 786 | } |
| 787 | /* NUTAG_ENABLEMESSENGER(win_messenger_enable) */ |
| 788 | else if (tag == nutag_enablemessenger) { |
| 789 | NHP_SET(nhp, win_messenger_enable, value != 0)((nhp)->nhp_win_messenger_enable = (value != 0), (nhp)-> nhp_set_.set_bits.nhb_win_messenger_enable = 1); |
| 790 | } |
| 791 | /* NUTAG_CALLEE_CAPS(callee_caps) */ |
| 792 | else if (tag == nutag_callee_caps) { |
| 793 | NHP_SET(nhp, callee_caps, value != 0)((nhp)->nhp_callee_caps = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_callee_caps = 1); |
| 794 | } |
| 795 | /* NUTAG_MEDIA_FEATURES(media_features) */ |
| 796 | else if (tag == nutag_media_features) { |
| 797 | NHP_SET(nhp, media_features, value != 0)((nhp)->nhp_media_features = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_media_features = 1); |
| 798 | } |
| 799 | /* NUTAG_SERVICE_ROUTE_ENABLE(service_route_enable) */ |
| 800 | else if (tag == nutag_service_route_enable) { |
| 801 | NHP_SET(nhp, service_route_enable, value != 0)((nhp)->nhp_service_route_enable = (value != 0), (nhp)-> nhp_set_.set_bits.nhb_service_route_enable = 1); |
| 802 | } |
| 803 | /* NUTAG_PATH_ENABLE(path_enable) */ |
| 804 | else if (tag == nutag_path_enable) { |
| 805 | NHP_SET(nhp, path_enable, value != 0)((nhp)->nhp_path_enable = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_path_enable = 1); |
| 806 | } |
| 807 | /* NUTAG_RETRY_AFTER_ENABLE(retry_after_enable) */ |
| 808 | else if (tag == nutag_retry_after_enable) { |
| 809 | NHP_SET(nhp, retry_after_enable, value != 0)((nhp)->nhp_retry_after_enable = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_retry_after_enable = 1); |
| 810 | } |
| 811 | /* NUTAG_AUTH_CACHE(auth_cache) */ |
| 812 | else if (tag == nutag_auth_cache) { |
| 813 | if (value >= 0 && value < (tag_value_t)_nua_auth_cache_invalid) |
| 814 | NHP_SET(nhp, auth_cache, (int)value)((nhp)->nhp_auth_cache = ((int)value), (nhp)->nhp_set_. set_bits.nhb_auth_cache = 1); |
| 815 | } |
| 816 | /* NUTAG_REFER_EXPIRES(refer_expires) */ |
| 817 | else if (tag == nutag_refer_expires) { |
| 818 | NHP_SET(nhp, refer_expires, value)((nhp)->nhp_refer_expires = (value), (nhp)->nhp_set_.set_bits .nhb_refer_expires = 1); |
| 819 | } |
| 820 | /* NUTAG_REFER_WITH_ID(refer_with_id) */ |
| 821 | else if (tag == nutag_refer_with_id) { |
| 822 | NHP_SET(nhp, refer_with_id, value != 0)((nhp)->nhp_refer_with_id = (value != 0), (nhp)->nhp_set_ .set_bits.nhb_refer_with_id = 1); |
| 823 | } |
| 824 | /* NUTAG_SUBSTATE(substate) */ |
| 825 | else if (tag == nutag_substate) { |
| 826 | NHP_SET(nhp, substate, (int)value)((nhp)->nhp_substate = ((int)value), (nhp)->nhp_set_.set_bits .nhb_substate = 1); |
| 827 | } |
| 828 | /* NUTAG_SUB_EXPIRES(sub_expires) */ |
| 829 | else if (tag == nutag_sub_expires) { |
| 830 | NHP_SET(nhp, sub_expires, value)((nhp)->nhp_sub_expires = (value), (nhp)->nhp_set_.set_bits .nhb_sub_expires = 1); |
| 831 | } |
| 832 | /* NUTAG_KEEPALIVE(keepalive) */ |
| 833 | else if (tag == nutag_keepalive) { |
| 834 | NHP_SET(nhp, keepalive, (unsigned)value)((nhp)->nhp_keepalive = ((unsigned)value), (nhp)->nhp_set_ .set_bits.nhb_keepalive = 1); |
| 835 | } |
| 836 | /* NUTAG_KEEPALIVE_STREAM(keepalive_stream) */ |
| 837 | else if (tag == nutag_keepalive_stream) { |
| 838 | NHP_SET(nhp, keepalive_stream, (unsigned)value)((nhp)->nhp_keepalive_stream = ((unsigned)value), (nhp)-> nhp_set_.set_bits.nhb_keepalive_stream = 1); |
| 839 | } |
| 840 | |
| 841 | /* NUTAG_SUPPORTED(feature) */ |
| 842 | /* SIPTAG_SUPPORTED_STR(supported_str) */ |
| 843 | /* SIPTAG_SUPPORTED(supported) */ |
| 844 | else if (tag == nutag_supported || |
| 845 | tag == siptag_supported || |
| 846 | tag == siptag_supported_str) { |
| 847 | int ok; |
| 848 | sip_supported_t *supported = NULL((void*)0); |
| 849 | |
| 850 | ok = nhp_merge_lists(home, |
| 851 | sip_supported_class, &supported, nhp->nhp_supported, |
| 852 | NHP_ISSET(nhp, supported)((nhp)->nhp_set_.set_bits.nhb_supported), /* already set by tags */ |
| 853 | tag == siptag_supported, /* dup it, don't make */ |
| 854 | tag == nutag_supported, /* merge with old value */ |
| 855 | t->t_value); |
| 856 | if (ok < 0) |
| 857 | return -1; |
| 858 | else if (ok) |
| 859 | NHP_SET(nhp, supported, supported)((nhp)->nhp_supported = (supported), (nhp)->nhp_set_.set_bits .nhb_supported = 1); |
| 860 | } |
| 861 | /* NUTAG_ALLOW(allowing) */ |
| 862 | /* SIPTAG_ALLOW_STR(allow_str) */ |
| 863 | /* SIPTAG_ALLOW(allow) */ |
| 864 | else if (tag == nutag_allow || |
| 865 | tag == siptag_allow_str || |
| 866 | tag == siptag_allow) { |
| 867 | int ok; |
| 868 | msg_list_t *allow = NULL((void*)0); |
| 869 | |
| 870 | ok = nhp_merge_lists(home, |
| 871 | sip_allow_class, |
| 872 | &allow, |
| 873 | (msg_list_t const *)nhp->nhp_allow, |
| 874 | NHP_ISSET(nhp, allow)((nhp)->nhp_set_.set_bits.nhb_allow), /* already set by tags */ |
| 875 | tag == siptag_allow, /* dup it, don't make */ |
| 876 | tag == nutag_allow, /* merge with old value */ |
| 877 | t->t_value); |
| 878 | if (ok < 0) |
| 879 | return -1; |
| 880 | else if (ok) |
| 881 | NHP_SET(nhp, allow, (sip_allow_t *)allow)((nhp)->nhp_allow = ((sip_allow_t *)allow), (nhp)->nhp_set_ .set_bits.nhb_allow = 1); |
| 882 | } |
| 883 | /* NUTAG_ALLOW_EVENTS(allow_events) */ |
| 884 | /* SIPTAG_ALLOW_EVENTS_STR(allow_events) */ |
| 885 | /* SIPTAG_ALLOW_EVENTS(allow_events) */ |
| 886 | else if (tag == nutag_allow_events || |
| 887 | tag == siptag_allow_events_str || |
| 888 | tag == siptag_allow_events) { |
| 889 | int ok; |
| 890 | sip_allow_events_t *allow_events = NULL((void*)0); |
| 891 | |
| 892 | ok = nhp_merge_lists(home, |
| 893 | sip_allow_events_class, |
| 894 | &allow_events, |
| 895 | nhp->nhp_allow_events, |
| 896 | NHP_ISSET(nhp, allow_events)((nhp)->nhp_set_.set_bits.nhb_allow_events), /* already set */ |
| 897 | tag == siptag_allow_events, /* dup it, don't make */ |
| 898 | tag == nutag_allow_events, /* merge with old value */ |
| 899 | t->t_value); |
| 900 | if (ok < 0) |
| 901 | return -1; |
| 902 | else if (ok) |
| 903 | NHP_SET(nhp, allow_events, allow_events)((nhp)->nhp_allow_events = (allow_events), (nhp)->nhp_set_ .set_bits.nhb_allow_events = 1); |
| 904 | } |
| 905 | /* NUTAG_APPL_METHOD(appl_method) */ |
| 906 | else if (tag == nutag_appl_method) { |
| 907 | if (t->t_value == 0) { |
| 908 | NHP_SET(nhp, appl_method, NULL)((nhp)->nhp_appl_method = (((void*)0)), (nhp)->nhp_set_ .set_bits.nhb_appl_method = 1); |
| 909 | } |
| 910 | else { |
| 911 | int ok; |
| 912 | msg_list_t *appl_method = NULL((void*)0); |
| 913 | |
| 914 | ok = nhp_merge_lists(home, |
| 915 | sip_allow_class, |
| 916 | &appl_method, |
| 917 | (msg_list_t const *)nhp->nhp_appl_method, |
| 918 | /* already set by tags? */ |
| 919 | NHP_ISSET(nhp, appl_method)((nhp)->nhp_set_.set_bits.nhb_appl_method), |
| 920 | 0, /* dup it, don't make */ |
| 921 | 1, /* merge with old value */ |
| 922 | t->t_value); |
| 923 | if (ok < 0) |
| 924 | return -1; |
| 925 | else if (ok) |
| 926 | NHP_SET(nhp, appl_method, (sip_allow_t *)appl_method)((nhp)->nhp_appl_method = ((sip_allow_t *)appl_method), (nhp )->nhp_set_.set_bits.nhb_appl_method = 1); |
| 927 | } |
| 928 | } |
| 929 | else if (tag == nutag_initial_route || |
| 930 | tag == nutag_initial_route_str) { |
| 931 | #define next_route(r)(&(r)->r_next) (&(r)->r_next) |
| 932 | NHP_APPEND_HEADER(nhp, initial_route, route,{ sip_route_t const *_value = (sip_route_t const *)(t->t_value ); char const *_str = (char const *)(t->t_value); sip_route_t *_new = ((void*)0); sip_route_t **_end = &nhp->nhp_initial_route ; if (_value != ((void const *)-1L) && _value != ((void *)0)) { _new = ((tag == nutag_initial_route_str)) ? sip_route_make (home, _str) : sip_route_dup(home, _value); if (_new == ((void *)0)) return -1; } if (((nhp)->nhp_set_.set_bits.nhb_initial_route )) while(*_end) _end = (&(*_end)->r_next); nhp->nhp_set_ .set_bits.nhb_initial_route = 1; *_end = _new; } |
| 933 | (tag == nutag_initial_route_str),{ sip_route_t const *_value = (sip_route_t const *)(t->t_value ); char const *_str = (char const *)(t->t_value); sip_route_t *_new = ((void*)0); sip_route_t **_end = &nhp->nhp_initial_route ; if (_value != ((void const *)-1L) && _value != ((void *)0)) { _new = ((tag == nutag_initial_route_str)) ? sip_route_make (home, _str) : sip_route_dup(home, _value); if (_new == ((void *)0)) return -1; } if (((nhp)->nhp_set_.set_bits.nhb_initial_route )) while(*_end) _end = (&(*_end)->r_next); nhp->nhp_set_ .set_bits.nhb_initial_route = 1; *_end = _new; } |
| 934 | next_route,{ sip_route_t const *_value = (sip_route_t const *)(t->t_value ); char const *_str = (char const *)(t->t_value); sip_route_t *_new = ((void*)0); sip_route_t **_end = &nhp->nhp_initial_route ; if (_value != ((void const *)-1L) && _value != ((void *)0)) { _new = ((tag == nutag_initial_route_str)) ? sip_route_make (home, _str) : sip_route_dup(home, _value); if (_new == ((void *)0)) return -1; } if (((nhp)->nhp_set_.set_bits.nhb_initial_route )) while(*_end) _end = (&(*_end)->r_next); nhp->nhp_set_ .set_bits.nhb_initial_route = 1; *_end = _new; } |
| 935 | t->t_value){ sip_route_t const *_value = (sip_route_t const *)(t->t_value ); char const *_str = (char const *)(t->t_value); sip_route_t *_new = ((void*)0); sip_route_t **_end = &nhp->nhp_initial_route ; if (_value != ((void const *)-1L) && _value != ((void *)0)) { _new = ((tag == nutag_initial_route_str)) ? sip_route_make (home, _str) : sip_route_dup(home, _value); if (_new == ((void *)0)) return -1; } if (((nhp)->nhp_set_.set_bits.nhb_initial_route )) while(*_end) _end = (&(*_end)->r_next); nhp->nhp_set_ .set_bits.nhb_initial_route = 1; *_end = _new; }; |
| 936 | sip_route_fix(nhp->nhp_initial_route); |
| 937 | } |
| 938 | /* SIPTAG_USER_AGENT(user_agent) */ |
| 939 | else if (tag == siptag_user_agent) { |
| 940 | NHP_SET_STR_BY_HEADER(nhp, user_agent, value)if ((value) != 0) { sip_user_agent_t const *_value = (sip_user_agent_t const *)(value); char *_new = ((void*)0); if (_value != ((void const *)-1L)) _new = sip_header_as_string(home, (void *)_value ); if (((nhp)->nhp_set_.set_bits.nhb_user_agent)) su_free( home, (void *)nhp->nhp_user_agent); ((nhp)->nhp_user_agent = (_new), (nhp)->nhp_set_.set_bits.nhb_user_agent = 1); if (_new == ((void*)0) && _value != ((void const *)-1L) ) return -1; }; |
| 941 | } |
| 942 | /* SIPTAG_USER_AGENT_STR(user_agent_str) */ |
| 943 | else if (tag == siptag_user_agent_str && value != 0) { |
| 944 | if (value == -1) |
| 945 | value = 0; |
| 946 | NHP_SET_STR(nhp, user_agent, value)if ((value) != (tag_value_t)0) { char const *_value = (char const *)value; char *_new = _value ? su_strdup(home, _value) : ((void *)0); if (((nhp)->nhp_set_.set_bits.nhb_user_agent)) su_free (home, (void *)nhp->nhp_user_agent); ((nhp)->nhp_user_agent = (_new), (nhp)->nhp_set_.set_bits.nhb_user_agent = 1); if (_new == ((void*)0) && _value != ((void*)0)) return - 1; }; |
| 947 | } |
| 948 | /* NUTAG_USER_AGENT(ua_name) */ |
| 949 | else if (tag == nutag_user_agent) { |
| 950 | /* Add contents of NUTAG_USER_AGENT() to our distribution name */ |
| 951 | char const *str = (void *)value, *ua; |
| 952 | |
| 953 | if (str && !already_contains_package_name(str)) |
| 954 | ua = su_sprintf(home, "%s %s", str, NHP_USER_AGENT"sofia-sip" "/" "1.12.10devel"); |
| 955 | else if (str) |
| 956 | ua = su_strdup(home, str); |
| 957 | else |
| 958 | ua = su_strdup(home, NHP_USER_AGENT"sofia-sip" "/" "1.12.10devel"); |
| 959 | |
| 960 | NHP_SET(nhp, user_agent, ua)((nhp)->nhp_user_agent = (ua), (nhp)->nhp_set_.set_bits .nhb_user_agent = 1); |
| 961 | } |
| 962 | /* SIPTAG_ORGANIZATION(organization) */ |
| 963 | else if (tag == siptag_organization) { |
| 964 | NHP_SET_STR_BY_HEADER(nhp, organization, value)if ((value) != 0) { sip_organization_t const *_value = (sip_organization_t const *)(value); char *_new = ((void*)0); if (_value != ((void const *)-1L)) _new = sip_header_as_string(home, (void *)_value ); if (((nhp)->nhp_set_.set_bits.nhb_organization)) su_free (home, (void *)nhp->nhp_organization); ((nhp)->nhp_organization = (_new), (nhp)->nhp_set_.set_bits.nhb_organization = 1); if (_new == ((void*)0) && _value != ((void const *)- 1L)) return -1; }; |
| 965 | } |
| 966 | /* SIPTAG_ORGANIZATION_STR(organization_str) */ |
| 967 | else if (tag == siptag_organization_str) { |
| 968 | if (value == -1) |
| 969 | value = 0; |
| 970 | NHP_SET_STR(nhp, organization, value)if ((value) != (tag_value_t)0) { char const *_value = (char const *)value; char *_new = _value ? su_strdup(home, _value) : ((void *)0); if (((nhp)->nhp_set_.set_bits.nhb_organization)) su_free (home, (void *)nhp->nhp_organization); ((nhp)->nhp_organization = (_new), (nhp)->nhp_set_.set_bits.nhb_organization = 1); if (_new == ((void*)0) && _value != ((void*)0)) return -1; }; |
| 971 | } |
| 972 | /* SIPTAG_VIA(via) */ |
| 973 | else if (tag == siptag_via) { |
| 974 | NHP_SET_STR_BY_HEADER(nhp, via, value)if ((value) != 0) { sip_via_t const *_value = (sip_via_t const *)(value); char *_new = ((void*)0); if (_value != ((void const *)-1L)) _new = sip_header_as_string(home, (void *)_value); if (((nhp)->nhp_set_.set_bits.nhb_via)) su_free(home, (void * )nhp->nhp_via); ((nhp)->nhp_via = (_new), (nhp)->nhp_set_ .set_bits.nhb_via = 1); if (_new == ((void*)0) && _value != ((void const *)-1L)) return -1; }; |
| 975 | } |
| 976 | /* SIPTAG_VIA_STR(via_str) */ |
| 977 | else if (tag == siptag_via_str) { |
| 978 | if (value == -1) |
| 979 | value = 0; |
| 980 | NHP_SET_STR(nhp, via, value)if ((value) != (tag_value_t)0) { char const *_value = (char const *)value; char *_new = _value ? su_strdup(home, _value) : ((void *)0); if (((nhp)->nhp_set_.set_bits.nhb_via)) su_free(home , (void *)nhp->nhp_via); ((nhp)->nhp_via = (_new), (nhp )->nhp_set_.set_bits.nhb_via = 1); if (_new == ((void*)0) && _value != ((void*)0)) return -1; }; |
| 981 | } |
| 982 | /* NUTAG_REGISTRAR(registrar) */ |
| 983 | else if (tag == nutag_registrar) { |
| 984 | NHP_SET_STR_BY_URL(nhp, char, registrar, value)if ((value) != (tag_value_t)-1) { url_t const *_value = (url_t const *)(value); char *_new = (char *)url_as_string(home, (void *)_value); if (((nhp)->nhp_set_.set_bits.nhb_registrar)) su_free (home, (void *)nhp->nhp_registrar); ((nhp)->nhp_registrar = (_new), (nhp)->nhp_set_.set_bits.nhb_registrar = 1); if (_new == ((void*)0) && _value != ((void*)0)) return - 1; }; |
| 985 | if (NHP_ISSET(nhp, registrar)((nhp)->nhp_set_.set_bits.nhb_registrar) && su_strmatch(nhp->nhp_registrar, "*")) |
| 986 | NHP_SET_STR(nhp, registrar, 0)if ((0) != (tag_value_t)0) { char const *_value = (char const *)0; char *_new = _value ? su_strdup(home, _value) : ((void* )0); if (((nhp)->nhp_set_.set_bits.nhb_registrar)) su_free (home, (void *)nhp->nhp_registrar); ((nhp)->nhp_registrar = (_new), (nhp)->nhp_set_.set_bits.nhb_registrar = 1); if (_new == ((void*)0) && _value != ((void*)0)) return - 1; }; |
| 987 | } |
| 988 | /* NUTAG_INSTANCE(instance) */ |
| 989 | else if (tag == nutag_instance) { |
| 990 | NHP_SET_STR(nhp, instance, value)if ((value) != (tag_value_t)0) { char const *_value = (char const *)value; char *_new = _value ? su_strdup(home, _value) : ((void *)0); if (((nhp)->nhp_set_.set_bits.nhb_instance)) su_free (home, (void *)nhp->nhp_instance); ((nhp)->nhp_instance = (_new), (nhp)->nhp_set_.set_bits.nhb_instance = 1); if ( _new == ((void*)0) && _value != ((void*)0)) return -1 ; }; |
| 991 | } |
| 992 | /* NUTAG_M_DISPLAY(m_display) */ |
| 993 | else if (tag == nutag_m_display) { |
| 994 | NHP_SET_STR(nhp, m_display, value)if ((value) != (tag_value_t)0) { char const *_value = (char const *)value; char *_new = _value ? su_strdup(home, _value) : ((void *)0); if (((nhp)->nhp_set_.set_bits.nhb_m_display)) su_free (home, (void *)nhp->nhp_m_display); ((nhp)->nhp_m_display = (_new), (nhp)->nhp_set_.set_bits.nhb_m_display = 1); if (_new == ((void*)0) && _value != ((void*)0)) return - 1; }; |
| 995 | } |
| 996 | /* NUTAG_M_USERNAME(m_username) */ |
| 997 | else if (tag == nutag_m_username) { |
| 998 | NHP_SET_STR(nhp, m_username, value)if ((value) != (tag_value_t)0) { char const *_value = (char const *)value; char *_new = _value ? su_strdup(home, _value) : ((void *)0); if (((nhp)->nhp_set_.set_bits.nhb_m_username)) su_free (home, (void *)nhp->nhp_m_username); ((nhp)->nhp_m_username = (_new), (nhp)->nhp_set_.set_bits.nhb_m_username = 1); if (_new == ((void*)0) && _value != ((void*)0)) return - 1; }; |
| 999 | } |
| 1000 | /* NUTAG_M_PARAMS(m_params) */ |
| 1001 | else if (tag == nutag_m_params) { |
| 1002 | NHP_SET_STR(nhp, m_params, value)if ((value) != (tag_value_t)0) { char const *_value = (char const *)value; char *_new = _value ? su_strdup(home, _value) : ((void *)0); if (((nhp)->nhp_set_.set_bits.nhb_m_params)) su_free (home, (void *)nhp->nhp_m_params); ((nhp)->nhp_m_params = (_new), (nhp)->nhp_set_.set_bits.nhb_m_params = 1); if ( _new == ((void*)0) && _value != ((void*)0)) return -1 ; }; |
| 1003 | } |
| 1004 | /* NUTAG_M_FEATURES(m_features) */ |
| 1005 | else if (tag == nutag_m_features) { |
| 1006 | NHP_SET_STR(nhp, m_features, value)if ((value) != (tag_value_t)0) { char const *_value = (char const *)value; char *_new = _value ? su_strdup(home, _value) : ((void *)0); if (((nhp)->nhp_set_.set_bits.nhb_m_features)) su_free (home, (void *)nhp->nhp_m_features); ((nhp)->nhp_m_features = (_new), (nhp)->nhp_set_.set_bits.nhb_m_features = 1); if (_new == ((void*)0) && _value != ((void*)0)) return - 1; }; |
| 1007 | } |
| 1008 | /* NUTAG_OUTBOUND(outbound) */ |
| 1009 | else if (tag == nutag_outbound) { |
| 1010 | NHP_SET_STR(nhp, outbound, value)if ((value) != (tag_value_t)0) { char const *_value = (char const *)value; char *_new = _value ? su_strdup(home, _value) : ((void *)0); if (((nhp)->nhp_set_.set_bits.nhb_outbound)) su_free (home, (void *)nhp->nhp_outbound); ((nhp)->nhp_outbound = (_new), (nhp)->nhp_set_.set_bits.nhb_outbound = 1); if ( _new == ((void*)0) && _value != ((void*)0)) return -1 ; }; |
| 1011 | } |
| 1012 | /* NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) */ |
| 1013 | else if (tag == ntatag_default_proxy) { |
| 1014 | NHP_SET_STR_BY_URL(nhp, url_string_t, proxy, value)if ((value) != (tag_value_t)-1) { url_t const *_value = (url_t const *)(value); url_string_t *_new = (url_string_t *)url_as_string (home, (void *)_value); if (((nhp)->nhp_set_.set_bits.nhb_proxy )) su_free(home, (void *)nhp->nhp_proxy); ((nhp)->nhp_proxy = (_new), (nhp)->nhp_set_.set_bits.nhb_proxy = 1); if (_new == ((void*)0) && _value != ((void*)0)) return -1; }; |
| 1015 | } |
| 1016 | /* NUTAG_DETECT_NETWORK_UPDATES(detect_network_updates) */ |
| 1017 | else if (ngp && tag == nutag_detect_network_updates) { |
| 1018 | int detector = (int)value; |
| 1019 | |
| 1020 | if (detector < NUA_NW_DETECT_NOTHING) |
| 1021 | detector = NUA_NW_DETECT_NOTHING; |
| 1022 | else if (detector > NUA_NW_DETECT_TRY_FULL) |
| 1023 | detector = NUA_NW_DETECT_TRY_FULL; |
| 1024 | |
| 1025 | ngp->ngp_detect_network_updates = detector; |
| 1026 | ngp->ngp_setngp_set_.set_bits.ngp_detect_network_updates = 1; |
| 1027 | } |
| 1028 | /* NUTAG_SHUTDOWN_EVENTS() */ |
| 1029 | else if (ngp && tag == nutag_shutdown_events) { |
| 1030 | ngp->ngp_shutdown_events = value != 0; |
| 1031 | ngp->ngp_setngp_set_.set_bits.ngp_shutdown_events = 1; |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | return 0; |
| 1036 | } |
| 1037 | |
| 1038 | /** Merge (when needed) new values with old values. */ |
| 1039 | static int nhp_merge_lists(su_home_t *home, |
| 1040 | msg_hclass_t *hc, |
| 1041 | msg_list_t **return_new_list, |
| 1042 | msg_list_t const *old_list, |
| 1043 | int already_set, |
| 1044 | int already_parsed, |
| 1045 | int always_merge, |
| 1046 | tag_value_t value) |
| 1047 | { |
| 1048 | msg_list_t *list, *elems; |
| 1049 | |
| 1050 | if (value == -1) { |
| 1051 | *return_new_list = NULL((void*)0); |
| 1052 | return 1; |
| 1053 | } |
| 1054 | |
| 1055 | if (value == 0) { |
| 1056 | if (!already_set && !always_merge) { |
| 1057 | *return_new_list = NULL((void*)0); |
| 1058 | return 1; |
| 1059 | } |
| 1060 | return 0; |
| 1061 | } |
| 1062 | |
| 1063 | if (already_parsed) |
| 1064 | elems = (void *)msg_header_dup_as(home, hc, (msg_header_t *)value); |
| 1065 | else |
| 1066 | elems = (void *)msg_header_make(home, hc, (char const *)value); |
| 1067 | |
| 1068 | if (!elems) |
| 1069 | return -1; |
| 1070 | |
| 1071 | list = (msg_list_t *)old_list; |
| 1072 | |
| 1073 | if (!already_set) { |
| 1074 | if (always_merge && list) { |
| 1075 | list = (void *)msg_header_dup_as(home, hc, (void *)old_list); |
| 1076 | if (!list) |
| 1077 | return -1; |
| 1078 | } |
| 1079 | else |
| 1080 | list = NULL((void*)0); |
| 1081 | } |
| 1082 | |
| 1083 | if (!list) { |
| 1084 | *return_new_list = elems; |
| 1085 | return 1; |
| 1086 | } |
| 1087 | |
| 1088 | /* Add contents to the new list to the old list */ |
| 1089 | if (msg_params_join(home, (msg_param_t **)&list->k_items, elems->k_items, |
| 1090 | 2 /* prune */, 0 /* don't dup */) < 0) |
| 1091 | return -1; |
| 1092 | |
| 1093 | *return_new_list = |
| 1094 | (msg_list_t *)msg_header_dup_as(home, hc, (msg_header_t *)list); |
| 1095 | if (!*return_new_list) |
| 1096 | return -1; |
| 1097 | |
| 1098 | msg_header_free(home, (msg_header_t *)list); |
| 1099 | msg_header_free(home, (msg_header_t *)elems); |
| 1100 | |
| 1101 | return 1; |
| 1102 | } |
| 1103 | |
| 1104 | /** Save parameters in @a gtmp and @a tmp. |
| 1105 | * |
| 1106 | * @retval 1 - parameters were changed |
| 1107 | * @retval 0 - no changes in parameters |
| 1108 | * @retval -1 - an error |
| 1109 | */ |
| 1110 | static |
| 1111 | int nhp_save_params(nua_handle_t *nh, |
| 1112 | su_home_t *tmphome, |
| 1113 | nua_global_preferences_t *gsrc, |
| 1114 | nua_handle_preferences_t *src) |
| 1115 | { |
| 1116 | su_home_t *home = nh->nh_home; |
| 1117 | nua_t *nua = nh->nh_nua; |
| 1118 | nua_handle_t *dnh = nua->nua_dhandlenua_handles; |
| 1119 | nua_handle_preferences_t *dst = nh->nh_prefs, old[1]; |
Value stored to 'dst' during its initialization is never read | |
| 1120 | |
| 1121 | if (gsrc) { |
| 1122 | *nua->nua_prefs = *gsrc; /* No pointers this far */ |
| 1123 | } |
| 1124 | |
| 1125 | if (!NHP_IS_ANY_SET(src)nhp_is_any_set((src))) |
| 1126 | return 0; |
| 1127 | |
| 1128 | if (nh == dnh || nh->nh_prefs != dnh->nh_prefs) { |
| 1129 | dst = nh->nh_prefs, *old = *dst; |
| 1130 | } |
| 1131 | else { |
| 1132 | dst = su_zalloc(home, sizeof *dst), memset(old, 0, sizeof *old); |
| 1133 | if (!dst) |
| 1134 | return -1; |
| 1135 | } |
| 1136 | |
| 1137 | /* Move allocations from tmphome to home */ |
| 1138 | su_home_move(nh->nh_home, tmphome); |
| 1139 | |
| 1140 | /* Copy parameters that are set from src to dst */ |
| 1141 | nhp_or_set(dst, src); |
| 1142 | |
| 1143 | /* Handle pointer items. Free changed ones and zap unset ones. */ |
| 1144 | /* Note that pointer items where !NHP_ISSET(old, pref) are not freed |
| 1145 | (because they were just on loan from the default preference set) */ |
| 1146 | #define NHP_ZAP_OVERRIDEN(old, dst, free, pref)(((((old)->nhp_set_.set_bits.nhb_pref) && (old)-> nhp_pref && (old)->nhp_pref != (dst)->nhp_pref) ? (free)(home, (void *)(old)->nhp_pref) : (void)0), (void )(!(dst)->nhp_set_.set_bits.nhb_pref ? (dst)->nhp_pref = ((void*)0) : ((void*)0))) \ |
| 1147 | (((NHP_ISSET(old, pref)((old)->nhp_set_.set_bits.nhb_pref) && \ |
| 1148 | (old)->nhp_##pref && (old)->nhp_##pref != (dst)->nhp_##pref) \ |
| 1149 | ? (free)(home, (void *)(old)->nhp_##pref) : (void)0), \ |
| 1150 | (void)(!(dst)->nhp_setnhp_set_.set_bits.nhb_##pref ? (dst)->nhp_##pref = NULL((void*)0) : NULL((void*)0))) |
| 1151 | |
| 1152 | NHP_ZAP_OVERRIDEN(old, dst, su_free, soa_name)(((((old)->nhp_set_.set_bits.nhb_soa_name) && (old )->nhp_soa_name && (old)->nhp_soa_name != (dst) ->nhp_soa_name) ? (su_free)(home, (void *)(old)->nhp_soa_name ) : (void)0), (void)(!(dst)->nhp_set_.set_bits.nhb_soa_name ? (dst)->nhp_soa_name = ((void*)0) : ((void*)0))); |
| 1153 | NHP_ZAP_OVERRIDEN(old, dst, su_free, registrar)(((((old)->nhp_set_.set_bits.nhb_registrar) && (old )->nhp_registrar && (old)->nhp_registrar != (dst )->nhp_registrar) ? (su_free)(home, (void *)(old)->nhp_registrar ) : (void)0), (void)(!(dst)->nhp_set_.set_bits.nhb_registrar ? (dst)->nhp_registrar = ((void*)0) : ((void*)0))); |
| 1154 | NHP_ZAP_OVERRIDEN(old, dst, msg_header_free, allow)(((((old)->nhp_set_.set_bits.nhb_allow) && (old)-> nhp_allow && (old)->nhp_allow != (dst)->nhp_allow ) ? (msg_header_free)(home, (void *)(old)->nhp_allow) : (void )0), (void)(!(dst)->nhp_set_.set_bits.nhb_allow ? (dst)-> nhp_allow = ((void*)0) : ((void*)0))); |
| 1155 | NHP_ZAP_OVERRIDEN(old, dst, msg_header_free, supported)(((((old)->nhp_set_.set_bits.nhb_supported) && (old )->nhp_supported && (old)->nhp_supported != (dst )->nhp_supported) ? (msg_header_free)(home, (void *)(old)-> nhp_supported) : (void)0), (void)(!(dst)->nhp_set_.set_bits .nhb_supported ? (dst)->nhp_supported = ((void*)0) : ((void *)0))); |
| 1156 | NHP_ZAP_OVERRIDEN(old, dst, msg_header_free, allow_events)(((((old)->nhp_set_.set_bits.nhb_allow_events) && ( old)->nhp_allow_events && (old)->nhp_allow_events != (dst)->nhp_allow_events) ? (msg_header_free)(home, (void *)(old)->nhp_allow_events) : (void)0), (void)(!(dst)-> nhp_set_.set_bits.nhb_allow_events ? (dst)->nhp_allow_events = ((void*)0) : ((void*)0))); |
| 1157 | NHP_ZAP_OVERRIDEN(old, dst, su_free, user_agent)(((((old)->nhp_set_.set_bits.nhb_user_agent) && (old )->nhp_user_agent && (old)->nhp_user_agent != ( dst)->nhp_user_agent) ? (su_free)(home, (void *)(old)-> nhp_user_agent) : (void)0), (void)(!(dst)->nhp_set_.set_bits .nhb_user_agent ? (dst)->nhp_user_agent = ((void*)0) : ((void *)0))); |
| 1158 | NHP_ZAP_OVERRIDEN(old, dst, su_free, organization)(((((old)->nhp_set_.set_bits.nhb_organization) && ( old)->nhp_organization && (old)->nhp_organization != (dst)->nhp_organization) ? (su_free)(home, (void *)(old )->nhp_organization) : (void)0), (void)(!(dst)->nhp_set_ .set_bits.nhb_organization ? (dst)->nhp_organization = ((void *)0) : ((void*)0))); |
| 1159 | NHP_ZAP_OVERRIDEN(old, dst, su_free, via)(((((old)->nhp_set_.set_bits.nhb_via) && (old)-> nhp_via && (old)->nhp_via != (dst)->nhp_via) ? ( su_free)(home, (void *)(old)->nhp_via) : (void)0), (void)( !(dst)->nhp_set_.set_bits.nhb_via ? (dst)->nhp_via = (( void*)0) : ((void*)0))); |
| 1160 | NHP_ZAP_OVERRIDEN(old, dst, su_free, m_display)(((((old)->nhp_set_.set_bits.nhb_m_display) && (old )->nhp_m_display && (old)->nhp_m_display != (dst )->nhp_m_display) ? (su_free)(home, (void *)(old)->nhp_m_display ) : (void)0), (void)(!(dst)->nhp_set_.set_bits.nhb_m_display ? (dst)->nhp_m_display = ((void*)0) : ((void*)0))); |
| 1161 | NHP_ZAP_OVERRIDEN(old, dst, su_free, m_username)(((((old)->nhp_set_.set_bits.nhb_m_username) && (old )->nhp_m_username && (old)->nhp_m_username != ( dst)->nhp_m_username) ? (su_free)(home, (void *)(old)-> nhp_m_username) : (void)0), (void)(!(dst)->nhp_set_.set_bits .nhb_m_username ? (dst)->nhp_m_username = ((void*)0) : ((void *)0))); |
| 1162 | NHP_ZAP_OVERRIDEN(old, dst, su_free, m_params)(((((old)->nhp_set_.set_bits.nhb_m_params) && (old )->nhp_m_params && (old)->nhp_m_params != (dst) ->nhp_m_params) ? (su_free)(home, (void *)(old)->nhp_m_params ) : (void)0), (void)(!(dst)->nhp_set_.set_bits.nhb_m_params ? (dst)->nhp_m_params = ((void*)0) : ((void*)0))); |
| 1163 | NHP_ZAP_OVERRIDEN(old, dst, su_free, m_features)(((((old)->nhp_set_.set_bits.nhb_m_features) && (old )->nhp_m_features && (old)->nhp_m_features != ( dst)->nhp_m_features) ? (su_free)(home, (void *)(old)-> nhp_m_features) : (void)0), (void)(!(dst)->nhp_set_.set_bits .nhb_m_features ? (dst)->nhp_m_features = ((void*)0) : ((void *)0))); |
| 1164 | NHP_ZAP_OVERRIDEN(old, dst, su_free, instance)(((((old)->nhp_set_.set_bits.nhb_instance) && (old )->nhp_instance && (old)->nhp_instance != (dst) ->nhp_instance) ? (su_free)(home, (void *)(old)->nhp_instance ) : (void)0), (void)(!(dst)->nhp_set_.set_bits.nhb_instance ? (dst)->nhp_instance = ((void*)0) : ((void*)0))); |
| 1165 | NHP_ZAP_OVERRIDEN(old, dst, su_free, outbound)(((((old)->nhp_set_.set_bits.nhb_outbound) && (old )->nhp_outbound && (old)->nhp_outbound != (dst) ->nhp_outbound) ? (su_free)(home, (void *)(old)->nhp_outbound ) : (void)0), (void)(!(dst)->nhp_set_.set_bits.nhb_outbound ? (dst)->nhp_outbound = ((void*)0) : ((void*)0))); |
| 1166 | NHP_ZAP_OVERRIDEN(old, dst, msg_header_free, appl_method)(((((old)->nhp_set_.set_bits.nhb_appl_method) && ( old)->nhp_appl_method && (old)->nhp_appl_method != (dst)->nhp_appl_method) ? (msg_header_free)(home, (void *)(old)->nhp_appl_method) : (void)0), (void)(!(dst)->nhp_set_ .set_bits.nhb_appl_method ? (dst)->nhp_appl_method = ((void *)0) : ((void*)0))); |
| 1167 | NHP_ZAP_OVERRIDEN(old, dst, msg_header_free, initial_route)(((((old)->nhp_set_.set_bits.nhb_initial_route) && (old)->nhp_initial_route && (old)->nhp_initial_route != (dst)->nhp_initial_route) ? (msg_header_free)(home, (void *)(old)->nhp_initial_route) : (void)0), (void)(!(dst)-> nhp_set_.set_bits.nhb_initial_route ? (dst)->nhp_initial_route = ((void*)0) : ((void*)0))); |
| 1168 | |
| 1169 | nh->nh_prefs = dst; |
| 1170 | |
| 1171 | return memcmp(dst, old, sizeof *dst) != 0; |
| 1172 | } |
| 1173 | |
| 1174 | static int nua_handle_tags_filter(tagi_t const *f, tagi_t const *t); |
| 1175 | static int nua_handle_param_filter(tagi_t const *f, tagi_t const *t); |
| 1176 | |
| 1177 | /** Save taglist to a handle */ |
| 1178 | int nua_handle_save_tags(nua_handle_t *nh, tagi_t *tags) |
| 1179 | { |
| 1180 | /* Initialization parameters */ |
| 1181 | url_string_t const *url = NULL((void*)0); |
| 1182 | sip_to_t const *p_to = NULL((void*)0); |
| 1183 | char const *to_str = NULL((void*)0); |
| 1184 | sip_from_t const *p_from = NULL((void*)0); |
| 1185 | char const *from_str = NULL((void*)0); |
| 1186 | nua_handle_t *identity = NULL((void*)0); |
| 1187 | |
| 1188 | tagi_t const *t; |
| 1189 | |
| 1190 | su_home_t tmphome[SU_HOME_AUTO_SIZE(1024)(((1024) + ((sizeof(su_home_t) + 7) & (size_t)~8) + ((3 * sizeof (void *) + 4 * sizeof(unsigned) + 7 * (sizeof (long) + sizeof(void *)) + 7) & (size_t)~8)) / sizeof(su_home_t))]; |
| 1191 | |
| 1192 | int error; |
| 1193 | |
| 1194 | #if HAVE_OPEN_C |
| 1195 | /* Nice. An old symbian compiler */ |
| 1196 | tagi_t tagfilter[2]; |
| 1197 | tagi_t paramfilter[2]; |
| 1198 | |
| 1199 | tagfilter[0].t_tag = tag_filter; |
| 1200 | tagfilter[0].t_value = tag_filter_v(nua_handle_tags_filter); |
| 1201 | tagfilter[1].t_tag = (tag_type_t)0; |
| 1202 | tagfilter[1].t_value = (tag_value_t)0; |
| 1203 | |
| 1204 | paramfilter[0].t_tag = tag_filter; |
| 1205 | paramfilter[0].t_value = tag_filter_v(nua_handle_param_filter); |
| 1206 | paramfilter[1].t_tag = (tag_type_t)0; |
| 1207 | paramfilter[1].t_value = (tag_value_t)0; |
| 1208 | |
| 1209 | #else |
| 1210 | tagi_t const tagfilter[] = { |
| 1211 | { TAG_FILTER(nua_handle_tags_filter)tag_filter, tag_filter_v(nua_handle_tags_filter) }, |
| 1212 | { TAG_NULL()(tag_type_t)0, (tag_value_t)0 } |
| 1213 | }; |
| 1214 | tagi_t const paramfilter[] = { |
| 1215 | { TAG_FILTER(nua_handle_param_filter)tag_filter, tag_filter_v(nua_handle_param_filter) }, |
| 1216 | { TAG_NULL()(tag_type_t)0, (tag_value_t)0 } |
| 1217 | }; |
| 1218 | #endif |
| 1219 | |
| 1220 | for (t = tags; t; t = tl_next(t)) { |
| 1221 | if (t->t_tag == NULL((void*)0)) |
| 1222 | break; |
| 1223 | /* SIPTAG_FROM_REF(p_from) */ |
| 1224 | else if (t->t_tag == siptag_from) { |
| 1225 | p_from = (sip_from_t *)t->t_value, from_str = NULL((void*)0); |
| 1226 | } |
| 1227 | /* SIPTAG_FROM_STR_REF(from_str) */ |
| 1228 | else if (t->t_tag == siptag_from_str) { |
| 1229 | from_str = (char const *)t->t_value, p_from = NULL((void*)0); |
| 1230 | } |
| 1231 | /* SIPTAG_TO_REF(p_to) */ |
| 1232 | else if (t->t_tag == siptag_to) { |
| 1233 | p_to = (sip_to_t *)t->t_value, to_str = NULL((void*)0); |
| 1234 | } |
| 1235 | /* SIPTAG_TO_STR_REF(to_str) */ |
| 1236 | else if (t->t_tag == siptag_to_str) { |
| 1237 | to_str = (char const *)t->t_value, p_to = NULL((void*)0); |
| 1238 | } |
| 1239 | /* NUTAG_IDENTITY_REF(identity) */ |
| 1240 | else if (t->t_tag == nutag_identity) { |
| 1241 | identity = (nua_handle_t *)t->t_value; |
| 1242 | } |
| 1243 | /* NUTAG_URL_REF(url) */ |
| 1244 | else if (t->t_tag == nutag_url) { |
| 1245 | url = (url_string_t *)t->t_value; |
| 1246 | } |
| 1247 | /* NUTAG_SIPS_URL_REF(url) */ |
| 1248 | else if (t->t_tag == nutag_sips_url) { |
| 1249 | url = (url_string_t *)t->t_value; |
| 1250 | } |
| 1251 | /* NUTAG_WS_URL_REF(url) */ |
| 1252 | else if (t->t_tag == nutag_ws_url) { |
| 1253 | url = (url_string_t *)t->t_value; |
| 1254 | } |
| 1255 | /* NUTAG_WSS_URL_REF(url) */ |
| 1256 | else if (t->t_tag == nutag_wss_url) { |
| 1257 | url = (url_string_t *)t->t_value; |
| 1258 | } |
| 1259 | } |
| 1260 | |
| 1261 | su_home_auto(tmphome, sizeof tmphome); |
| 1262 | |
| 1263 | if (p_from) |
| 1264 | ; |
| 1265 | else if (from_str) |
| 1266 | p_from = sip_from_make(tmphome, from_str); |
| 1267 | else |
| 1268 | p_from = SIP_NONE((void const *)-1L); |
| 1269 | |
| 1270 | if (p_to) |
| 1271 | ; |
| 1272 | else if (to_str) |
| 1273 | p_to = sip_to_make(tmphome, to_str); |
| 1274 | else if (url) |
| 1275 | p_to = sip_to_create(tmphome, url), |
| 1276 | p_to ? sip_aor_strip((url_t*)p_to->a_url) : 0; |
| 1277 | else |
| 1278 | p_to = SIP_NONE((void const *)-1L); |
| 1279 | |
| 1280 | if (p_to == NULL((void*)0) || p_from == NULL((void*)0)) { |
| 1281 | su_home_deinit(tmphome); |
| 1282 | return -1; |
| 1283 | } |
| 1284 | |
| 1285 | nh->nh_tags = |
| 1286 | tl_filtered_tlist(nh->nh_home, tagfilter, |
| 1287 | TAG_IF(p_from != SIP_NONE, SIPTAG_FROM(p_from))!(p_from != ((void const *)-1L)) ? tag_skip : siptag_from, siptag_from_v (p_from), |
| 1288 | TAG_IF(p_from != SIP_NONE, TAG_FILTER(nua_handle_tags_filter))!(p_from != ((void const *)-1L)) ? tag_skip : tag_filter, tag_filter_v (nua_handle_tags_filter), |
| 1289 | TAG_IF(p_to != SIP_NONE, SIPTAG_TO(p_to))!(p_to != ((void const *)-1L)) ? tag_skip : siptag_to, siptag_to_v (p_to), |
| 1290 | TAG_IF(p_to != SIP_NONE, TAG_FILTER(nua_handle_tags_filter))!(p_to != ((void const *)-1L)) ? tag_skip : tag_filter, tag_filter_v (nua_handle_tags_filter), |
| 1291 | TAG_NEXT(tags)tag_next, (tag_value_t)(tags)); |
| 1292 | |
| 1293 | nh->nh_ptags = |
| 1294 | tl_filtered_tlist(nh->nh_home, paramfilter, TAG_NEXT(tags)tag_next, (tag_value_t)(tags)); |
| 1295 | |
| 1296 | error = nh->nh_tags == NULL((void*)0) || nh->nh_ptags == NULL((void*)0); |
| 1297 | |
| 1298 | if (!error) |
| 1299 | tl_gets(nh->nh_tags, /* These does not change while nh lives */ |
| 1300 | SIPTAG_FROM_REF(nh->nh_ds->ds_local)siptag_from_ref, siptag_from_vr(&(nh->nh_ds->ds_local )), |
| 1301 | SIPTAG_TO_REF(nh->nh_ds->ds_remote)siptag_to_ref, siptag_to_vr(&(nh->nh_ds->ds_remote) ), |
| 1302 | TAG_END()(tag_type_t)0, (tag_value_t)0); |
| 1303 | |
| 1304 | if (nh->nh_ptags && nh->nh_ptags->t_tag == NULL((void*)0)) |
| 1305 | su_free(nh->nh_home, nh->nh_ptags), nh->nh_ptags = NULL((void*)0); |
| 1306 | |
| 1307 | if (identity) |
| 1308 | nh->nh_identity = nua_handle_ref(identity); |
| 1309 | |
| 1310 | su_home_deinit(tmphome); |
| 1311 | |
| 1312 | return -error; |
| 1313 | } |
| 1314 | |
| 1315 | /** Filter tags used for settings. */ |
| 1316 | static int nua_handle_param_filter(tagi_t const *f, tagi_t const *t) |
| 1317 | { |
| 1318 | char const *ns; |
| 1319 | |
| 1320 | if (!t || !t->t_tag) |
| 1321 | return 0; |
| 1322 | |
| 1323 | if (t->t_tag == nutag_url || |
| 1324 | t->t_tag == nutag_sips_url || |
| 1325 | t->t_tag == nutag_ws_url || |
| 1326 | t->t_tag == nutag_wss_url || |
| 1327 | t->t_tag == nutag_identity) |
| 1328 | return 0; |
| 1329 | |
| 1330 | ns = t->t_tag->tt_ns; |
| 1331 | if (!ns) |
| 1332 | return 0; |
| 1333 | |
| 1334 | return strcmp(ns, "nua")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (ns) && __builtin_constant_p ("nua") && (__s1_len = __builtin_strlen (ns), __s2_len = __builtin_strlen ("nua") , (!((size_t)(const void *)((ns) + 1) - (size_t)(const void * )(ns) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("nua") + 1) - (size_t)(const void *)("nua") == 1) || __s2_len >= 4)) ? __builtin_strcmp (ns, "nua") : (__builtin_constant_p (ns) && ((size_t)(const void *)((ns) + 1) - (size_t) (const void *)(ns) == 1) && (__s1_len = __builtin_strlen (ns), __s1_len < 4) ? (__builtin_constant_p ("nua") && ((size_t)(const void *)(("nua") + 1) - (size_t)(const void * )("nua") == 1) ? __builtin_strcmp (ns, "nua") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("nua"); int __result = (((const unsigned char *) (const char *) (ns))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( ns))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (ns ))[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (ns))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("nua" ) && ((size_t)(const void *)(("nua") + 1) - (size_t)( const void *)("nua") == 1) && (__s2_len = __builtin_strlen ("nua"), __s2_len < 4) ? (__builtin_constant_p (ns) && ((size_t)(const void *)((ns) + 1) - (size_t)(const void *)(ns ) == 1) ? __builtin_strcmp (ns, "nua") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (ns); int __result = (((const unsigned char *) (const char *) ("nua"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "nua"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "nua"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("nua" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (ns, "nua")))); }) == 0 || strcmp(ns, "soa")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (ns) && __builtin_constant_p ("soa") && (__s1_len = __builtin_strlen (ns), __s2_len = __builtin_strlen ("soa") , (!((size_t)(const void *)((ns) + 1) - (size_t)(const void * )(ns) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("soa") + 1) - (size_t)(const void *)("soa") == 1) || __s2_len >= 4)) ? __builtin_strcmp (ns, "soa") : (__builtin_constant_p (ns) && ((size_t)(const void *)((ns) + 1) - (size_t) (const void *)(ns) == 1) && (__s1_len = __builtin_strlen (ns), __s1_len < 4) ? (__builtin_constant_p ("soa") && ((size_t)(const void *)(("soa") + 1) - (size_t)(const void * )("soa") == 1) ? __builtin_strcmp (ns, "soa") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("soa"); int __result = (((const unsigned char *) (const char *) (ns))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( ns))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (ns ))[2] - __s2[2]); if (__s1_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) (ns))[3 ] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("soa" ) && ((size_t)(const void *)(("soa") + 1) - (size_t)( const void *)("soa") == 1) && (__s2_len = __builtin_strlen ("soa"), __s2_len < 4) ? (__builtin_constant_p (ns) && ((size_t)(const void *)((ns) + 1) - (size_t)(const void *)(ns ) == 1) ? __builtin_strcmp (ns, "soa") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (ns); int __result = (((const unsigned char *) (const char *) ("soa"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "soa"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "soa"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("soa" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (ns, "soa")))); }) == 0; |
| 1335 | } |
| 1336 | |
| 1337 | /** Filter tags stored permanently as taglist. */ |
| 1338 | static int nua_handle_tags_filter(tagi_t const *f, tagi_t const *t) |
| 1339 | { |
| 1340 | tag_type_t tag; |
| 1341 | |
| 1342 | if (!t || !t->t_tag) |
| 1343 | return 0; |
| 1344 | |
| 1345 | tag = t->t_tag; |
| 1346 | |
| 1347 | if (tag == tag_filter) |
| 1348 | return 0; |
| 1349 | |
| 1350 | /* Accept @From or @To only when they are followed by |
| 1351 | TAG_FILTER(nua_handle_tags_filter) */ |
| 1352 | if (tag == siptag_from || tag == siptag_to) { |
| 1353 | t = tl_next(t); |
| 1354 | return t && t->t_tag == tag_filter && |
| 1355 | t->t_value == (tag_value_t)nua_handle_tags_filter; |
| 1356 | } |
| 1357 | |
| 1358 | if (tag == nutag_identity) |
| 1359 | return 0; |
| 1360 | if (tag == siptag_from_str) |
| 1361 | return 0; |
| 1362 | if (tag == siptag_to_str) |
| 1363 | return 0; |
| 1364 | |
| 1365 | /** Ignore @CSeq, @RSeq, @RAck, @Timestamp, and @ContentLength */ |
| 1366 | if (tag == siptag_cseq || tag == siptag_cseq_str) |
| 1367 | return 0; |
| 1368 | if (tag == siptag_rseq || tag == siptag_rseq_str) |
| 1369 | return 0; |
| 1370 | if (tag == siptag_rack || tag == siptag_rack_str) |
| 1371 | return 0; |
| 1372 | if (tag == siptag_timestamp || tag == siptag_timestamp_str) |
| 1373 | return 0; |
| 1374 | if (tag == siptag_content_length || tag == siptag_content_length_str) |
| 1375 | return 0; |
| 1376 | |
| 1377 | return ! nua_handle_param_filter(f, t); |
| 1378 | } |
| 1379 | |
| 1380 | static |
| 1381 | int nua_stack_set_smime_params(nua_t *nua, tagi_t const *tags) |
| 1382 | { |
| 1383 | #if HAVE_SOFIA_SMIME0 |
| 1384 | int smime_enable = nua->sm->sm_enable; |
| 1385 | int smime_opt = nua->sm->sm_opt; |
| 1386 | int smime_protection_mode = nua->sm->sm_protection_mode; |
| 1387 | char const *smime_message_digest = NONE((void *)-1); |
| 1388 | char const *smime_signature = NONE((void *)-1); |
| 1389 | char const *smime_key_encryption = NONE((void *)-1); |
| 1390 | char const *smime_message_encryption = NONE((void *)-1); |
| 1391 | char const *smime_path = NONE((void *)-1); |
| 1392 | |
| 1393 | int n; |
| 1394 | |
| 1395 | n = tl_gets(tags, |
| 1396 | NUTAG_SMIME_ENABLE_REF(smime_enable)nutag_smime_enable_ref, tag_bool_vr(&(smime_enable)), |
| 1397 | NUTAG_SMIME_OPT_REF(smime_opt)nutag_smime_opt_ref, tag_int_vr(&(smime_opt)), |
| 1398 | NUTAG_SMIME_PROTECTION_MODE_REF(smime_protection_mode)nutag_smime_protection_mode_ref, tag_uint_vr(&(smime_protection_mode )), |
| 1399 | NUTAG_SMIME_MESSAGE_DIGEST_REF(smime_message_digest)nutag_smime_message_digest_ref, tag_str_vr((&smime_message_digest )), |
| 1400 | NUTAG_SMIME_SIGNATURE_REF(smime_signature)nutag_smime_signature_ref, tag_str_vr((&smime_signature)), |
| 1401 | NUTAG_SMIME_KEY_ENCRYPTION_REF(smime_key_encryption)nutag_smime_key_encryption_ref, tag_str_vr((&smime_key_encryption )), |
| 1402 | NUTAG_SMIME_MESSAGE_ENCRYPTION_REF(smime_message_encryption)nutag_smime_message_encryption_ref, tag_str_vr((&smime_message_encryption )), |
| 1403 | NUTAG_CERTIFICATE_DIR_REF(smime_path)nutag_certificate_dir_ref, tag_str_vr((&smime_path)), |
| 1404 | TAG_NULL()(tag_type_t)0, (tag_value_t)0); |
| 1405 | if (n <= 0) |
| 1406 | return n; |
| 1407 | |
| 1408 | /* XXX - all other S/MIME parameters? */ |
| 1409 | return sm_set_params(nua->sm, smime_enable, smime_opt, |
| 1410 | smime_protection_mode, smime_path); |
| 1411 | #endif |
| 1412 | |
| 1413 | return 0; |
| 1414 | } |
| 1415 | |
| 1416 | /**@fn void nua_get_params(nua_t *nua, tag_type_t tag, tag_value_t value, ...) |
| 1417 | * |
| 1418 | * Get NUA parameters matching with the given filter. |
| 1419 | * The values of NUA parameters is returned in #nua_r_get_params event. |
| 1420 | * |
| 1421 | * @param nua Pointer to NUA stack object |
| 1422 | * @param tag, value, ... List of tagged parameters |
| 1423 | * |
| 1424 | * @return |
| 1425 | * nothing |
| 1426 | * |
| 1427 | * @par Related tags: |
| 1428 | * TAG_ANY() \n |
| 1429 | * otherwise same tags as nua_set_params() |
| 1430 | * |
| 1431 | * @par Events: |
| 1432 | * #nua_r_get_params |
| 1433 | * |
| 1434 | * @par Examples |
| 1435 | * Find out default values of all parameters: |
| 1436 | * @code |
| 1437 | * nua_get_params(nua, TAG_ANY(), TAG_END()); |
| 1438 | * @endcode |
| 1439 | */ |
| 1440 | |
| 1441 | /**@fn void nua_get_hparams(nua_handle_t *nh, tag_type_t tag, tag_value_t value, ...) |
| 1442 | * |
| 1443 | * Get values of handle-specific parameters in #nua_r_get_params event. |
| 1444 | * |
| 1445 | * Application will specify either expilicit list of tags it is interested |
| 1446 | * in, or a filter (at the moment, TAG_ANY()). The values are returned as a |
| 1447 | * list of tags in the #nua_r_get_params event. |
| 1448 | * |
| 1449 | * @param nh Pointer to operation handle |
| 1450 | * @param tag, value, ... List of tagged parameters |
| 1451 | * |
| 1452 | * The handle-specific parameters will contain only the parameters actually |
| 1453 | * modified by application, either by nua_set_hparams() or some other |
| 1454 | * handle-specific call. Currently, no NTA parameters are returned. They are |
| 1455 | * returned only when application asks for user-agent-level parameters using |
| 1456 | * either nua_get_params() or using default handle, eg. |
| 1457 | * @code |
| 1458 | * nua_get_hparams(nua_default(nua), TAG_ANY()) |
| 1459 | * @endcode |
| 1460 | * |
| 1461 | * @return |
| 1462 | * nothing |
| 1463 | * |
| 1464 | * @par Related tags: |
| 1465 | * #TAG_ANY \n |
| 1466 | * othervise same tags as nua_set_hparams() |
| 1467 | * |
| 1468 | * @par Events: |
| 1469 | * #nua_r_get_params |
| 1470 | */ |
| 1471 | |
| 1472 | /** @NUA_EVENT nua_r_get_params |
| 1473 | * |
| 1474 | * Answer to nua_get_params() or nua_get_hparams(). |
| 1475 | * |
| 1476 | * @param status 200 when succesful, error code otherwise |
| 1477 | * @param phrase a short textual description of @a status code |
| 1478 | * @param nh NULL when responding to nua_get_params(), |
| 1479 | * operation handle when responding to nua_get_hparams() |
| 1480 | * @param hmagic NULL when responding to nua_get_params(), |
| 1481 | * application contact associated with the operation handle |
| 1482 | * when responding to nua_get_hparams() |
| 1483 | * @param sip NULL |
| 1484 | * @param tags |
| 1485 | * NUTAG_APPL_METHOD() \n |
| 1486 | * NUTAG_AUTH_CACHE() \n |
| 1487 | * NUTAG_AUTOACK() \n |
| 1488 | * NUTAG_AUTOALERT() \n |
| 1489 | * NUTAG_AUTOANSWER() \n |
| 1490 | * NUTAG_CALLEE_CAPS() \n |
| 1491 | * NUTAG_DETECT_NETWORK_UPDATES() \n |
| 1492 | * NUTAG_EARLY_ANSWER() \n |
| 1493 | * NUTAG_EARLY_MEDIA() \n |
| 1494 | * NUTAG_ENABLEINVITE() \n |
| 1495 | * NUTAG_ENABLEMESSAGE() \n |
| 1496 | * NUTAG_ENABLEMESSENGER() \n |
| 1497 | * NUTAG_INITIAL_ROUTE() \n |
| 1498 | * NUTAG_INITIAL_ROUTE_STR() \n |
| 1499 | * NUTAG_INSTANCE() \n |
| 1500 | * NUTAG_INVITE_TIMER() \n |
| 1501 | * NUTAG_KEEPALIVE() \n |
| 1502 | * NUTAG_KEEPALIVE_STREAM() \n |
| 1503 | * NUTAG_MAX_SUBSCRIPTIONS() \n |
| 1504 | * NUTAG_MEDIA_ENABLE() \n |
| 1505 | * NUTAG_MEDIA_FEATURES() \n |
| 1506 | * NUTAG_MIN_SE() \n |
| 1507 | * NUTAG_M_DISPLAY() \n |
| 1508 | * NUTAG_M_FEATURES() \n |
| 1509 | * NUTAG_M_PARAMS() \n |
| 1510 | * NUTAG_M_USERNAME() \n |
| 1511 | * NUTAG_ONLY183_100REL() \n |
| 1512 | * NUTAG_OUTBOUND() \n |
| 1513 | * NUTAG_PATH_ENABLE() \n |
| 1514 | * NUTAG_RETRY_AFTER_ENABLE() \n |
| 1515 | * NUTAG_REFER_EXPIRES() \n |
| 1516 | * NUTAG_REFER_WITH_ID() \n |
| 1517 | * NUTAG_REFRESH_WITHOUT_SDP() \n |
| 1518 | * NUTAG_REGISTRAR() \n |
| 1519 | * NUTAG_RETRY_COUNT() \n |
| 1520 | * NUTAG_SERVICE_ROUTE_ENABLE() \n |
| 1521 | * NUTAG_SESSION_REFRESHER() \n |
| 1522 | * NUTAG_SESSION_TIMER() \n |
| 1523 | * NUTAG_SMIME_ENABLE() \n |
| 1524 | * NUTAG_SMIME_KEY_ENCRYPTION() \n |
| 1525 | * NUTAG_SMIME_MESSAGE_DIGEST() \n |
| 1526 | * NUTAG_SMIME_MESSAGE_ENCRYPTION() \n |
| 1527 | * NUTAG_SMIME_OPT() \n |
| 1528 | * NUTAG_SMIME_PROTECTION_MODE() \n |
| 1529 | * NUTAG_SMIME_SIGNATURE() \n |
| 1530 | * NUTAG_SOA_NAME() \n |
| 1531 | * NUTAG_SUBSTATE() \n |
| 1532 | * NUTAG_SUB_EXPIRES() \n |
| 1533 | * NUTAG_UPDATE_REFRESH() \n |
| 1534 | * NUTAG_USER_AGENT() \n |
| 1535 | * SIPTAG_ALLOW() \n |
| 1536 | * SIPTAG_ALLOW_STR() \n |
| 1537 | * SIPTAG_ALLOW_EVENTS() \n |
| 1538 | * SIPTAG_ALLOW_EVENTS_STR() \n |
| 1539 | * SIPTAG_FROM() \n |
| 1540 | * SIPTAG_FROM_STR() \n |
| 1541 | * SIPTAG_ORGANIZATION() \n |
| 1542 | * SIPTAG_ORGANIZATION_STR() \n |
| 1543 | * SIPTAG_SUPPORTED() \n |
| 1544 | * SIPTAG_SUPPORTED_STR() \n |
| 1545 | * SIPTAG_USER_AGENT() \n |
| 1546 | * SIPTAG_USER_AGENT_STR() \n |
| 1547 | * |
| 1548 | * @sa nua_get_params(), nua_get_hparams(), |
| 1549 | * nua_set_params(), nua_set_hparams(), #nua_r_set_params |
| 1550 | * |
| 1551 | * @END_NUA_EVENT |
| 1552 | */ |
| 1553 | |
| 1554 | /**@internal |
| 1555 | * Send a list of NUA parameters to the application. |
| 1556 | * |
| 1557 | * This function gets invoked when application calls either nua_get_params() |
| 1558 | * or nua_get_hparams(). |
| 1559 | * |
| 1560 | * The parameter tag list will initially contain all the relevant parameter |
| 1561 | * tags, and it will be filtered down to parameters asked by application. |
| 1562 | * |
| 1563 | * The handle-specific parameters will contain only the parameters actually |
| 1564 | * modified by application, either by nua_set_hparams() or some other |
| 1565 | * handle-specific call. NTA parameters are returned only when application |
| 1566 | * asks for user-agent-level parameters using nua_get_params(). |
| 1567 | * |
| 1568 | */ |
| 1569 | int nua_stack_get_params(nua_t *nua, nua_handle_t *nh, nua_event_t e, |
| 1570 | tagi_t const *tags) |
| 1571 | { |
| 1572 | nua_handle_t *dnh = nua->nua_dhandlenua_handles; |
| 1573 | nua_global_preferences_t const *ngp = nua->nua_prefs; |
| 1574 | nua_handle_preferences_t const *nhp = nh->nh_prefs; |
| 1575 | nua_handle_preferences_t const nhp_zero[1] = {{ 0 }}; |
| 1576 | tagi_t *lst; |
| 1577 | |
| 1578 | int has_from; |
| 1579 | sip_from_t from[1]; |
| 1580 | |
| 1581 | sip_contact_t const *m; |
| 1582 | |
| 1583 | /* nta */ |
| 1584 | unsigned udp_mtu = 0; |
| 1585 | usize_t max_proceeding = 0; |
| 1586 | unsigned sip_t1 = 0, sip_t2 = 0, sip_t4 = 0, sip_t1x64 = 0; |
| 1587 | unsigned debug_drop_prob = 0; |
| 1588 | url_string_t const *proxy = NULL((void*)0); |
| 1589 | sip_contact_t const *aliases = NULL((void*)0); |
| 1590 | unsigned flags = 0; |
| 1591 | |
| 1592 | /* soa */ |
| 1593 | tagi_t *media_params = NULL((void*)0); |
| 1594 | |
| 1595 | su_home_t tmphome[SU_HOME_AUTO_SIZE(16536)(((16536) + ((sizeof(su_home_t) + 7) & (size_t)~8) + ((3 * sizeof (void *) + 4 * sizeof(unsigned) + 7 * (sizeof (long) + sizeof(void *)) + 7) & (size_t)~8)) / sizeof(su_home_t))]; |
| 1596 | |
| 1597 | enter(void)((((nua_log) != ((void*)0) && (nua_log)->log_init ) == 0 ? 9 : (((nua_log) != ((void*)0) && (nua_log)-> log_init > 1) ? (nua_log)->log_level : su_log_default-> log_level)) >= 9 ? (_su_llog((nua_log), 9, "nua_params.c", (const char *)__func__, 1597, "nua: %s: entering\n", __func__ )) : (void)0); |
| 1598 | |
| 1599 | if (nh == dnh) |
| 1600 | nta_agent_get_params(nua->nua_nta, |
| 1601 | NTATAG_UDP_MTU_REF(udp_mtu)ntatag_udp_mtu_ref, tag_uint_vr(&(udp_mtu)), |
| 1602 | NTATAG_MAX_PROCEEDING_REF(max_proceeding)ntatag_max_proceeding_ref, tag_usize_vr(&(max_proceeding) ), |
| 1603 | NTATAG_SIP_T1_REF(sip_t1)ntatag_sip_t1_ref, tag_uint_vr(&(sip_t1)), |
| 1604 | NTATAG_SIP_T2_REF(sip_t2)ntatag_sip_t2_ref, tag_uint_vr(&(sip_t2)), |
| 1605 | NTATAG_SIP_T4_REF(sip_t4)ntatag_sip_t4_ref, tag_uint_vr(&(sip_t4)), |
| 1606 | NTATAG_SIP_T1X64_REF(sip_t1x64)ntatag_sip_t1x64_ref, tag_uint_vr(&(sip_t1x64)), |
| 1607 | NTATAG_DEBUG_DROP_PROB_REF(debug_drop_prob)ntatag_debug_drop_prob_ref, tag_uint_vr(&(debug_drop_prob )), |
| 1608 | NTATAG_DEFAULT_PROXY_REF(proxy)ntatag_default_proxy_ref, urltag_url_vr(&(proxy)), |
| 1609 | NTATAG_ALIASES_REF(aliases)ntatag_aliases_ref, siptag_contact_vr(&(aliases)), |
| 1610 | NTATAG_SIPFLAGS_REF(flags)ntatag_sipflags_ref, tag_uint_vr(&(flags)), |
| 1611 | TAG_END()(tag_type_t)0, (tag_value_t)0); |
| 1612 | |
| 1613 | if (nh->nh_ds->ds_local) |
| 1614 | has_from = 1, *from = *nh->nh_ds->ds_local, from->a_params = NULL((void*)0); |
| 1615 | else /* if (nua->nua_from_is_set) */ |
| 1616 | has_from = 1, *from = *nua->nua_from; |
| 1617 | |
| 1618 | media_params = soa_get_paramlist(nh->nh_soa, TAG_END()(tag_type_t)0, (tag_value_t)0); |
| 1619 | |
| 1620 | m = nua_stack_get_contact(nua->nua_registrations); |
| 1621 | |
| 1622 | /* Include tag in the list returned to user |
| 1623 | * if it has been earlier set (by user) */ |
| 1624 | #define TIF(TAG, pref)!(nhp->nhp_set_.set_bits.nhb_pref) ? tag_skip : TAG(nhp-> nhp_pref) \ |
| 1625 | TAG_IF(nhp->nhp_set.nhb_##pref, TAG(nhp->nhp_##pref))!(nhp->nhp_set_.set_bits.nhb_##pref) ? tag_skip : TAG(nhp-> nhp_##pref) |
| 1626 | |
| 1627 | /* Include tag in the list returned to user |
| 1628 | * if it has been earlier set (by user) |
| 1629 | * but always include in the default parameters */ |
| 1630 | #define TIFD(TAG, pref)!(nh == dnh || nhp->nhp_set_.set_bits.nhb_pref) ? tag_skip : TAG(nhp->nhp_pref) \ |
| 1631 | TAG_IF(nh == dnh || nhp->nhp_set.nhb_##pref, TAG(nhp->nhp_##pref))!(nh == dnh || nhp->nhp_set_.set_bits.nhb_##pref) ? tag_skip : TAG(nhp->nhp_##pref) |
| 1632 | |
| 1633 | /* Include string tag made out of SIP header |
| 1634 | * if it has been earlier set (by user) */ |
| 1635 | #define TIF_STR(TAG, pref)!(nhp->nhp_set_.set_bits.nhb_pref) ? tag_skip : TAG(nhp-> nhp_set_.set_bits.nhb_pref && nhp->nhp_pref ? sip_header_as_string (tmphome, (void *)nhp->nhp_pref) : ((void*)0)) \ |
| 1636 | TAG_IF(nhp->nhp_set.nhb_##pref, \!(nhp->nhp_set_.set_bits.nhb_##pref) ? tag_skip : TAG(nhp-> nhp_set_.set_bits.nhb_##pref && nhp->nhp_##pref ? sip_header_as_string (tmphome, (void *)nhp->nhp_##pref) : ((void*)0)) |
| 1637 | TAG(nhp->nhp_set.nhb_##pref && nhp->nhp_##pref \!(nhp->nhp_set_.set_bits.nhb_##pref) ? tag_skip : TAG(nhp-> nhp_set_.set_bits.nhb_##pref && nhp->nhp_##pref ? sip_header_as_string (tmphome, (void *)nhp->nhp_##pref) : ((void*)0)) |
| 1638 | ? sip_header_as_string(tmphome, (void *)nhp->nhp_##pref) : NULL))!(nhp->nhp_set_.set_bits.nhb_##pref) ? tag_skip : TAG(nhp-> nhp_set_.set_bits.nhb_##pref && nhp->nhp_##pref ? sip_header_as_string (tmphome, (void *)nhp->nhp_##pref) : ((void*)0)) |
| 1639 | |
| 1640 | /* Include header tag made out of string |
| 1641 | * if it has been earlier set (by user) */ |
| 1642 | #define TIF_SIP(TAG, pref)!(nhp->nhp_set_.set_bits.nhb_pref) ? tag_skip : TAG(nhp-> nhp_set_.set_bits.nhb_pref && nhp->nhp_pref ? sip_pref_make (tmphome, (char *)nhp->nhp_pref) : ((void*)0)) \ |
| 1643 | TAG_IF(nhp->nhp_set.nhb_##pref, \!(nhp->nhp_set_.set_bits.nhb_##pref) ? tag_skip : TAG(nhp-> nhp_set_.set_bits.nhb_##pref && nhp->nhp_##pref ? sip_ ##pref##_make(tmphome, (char *)nhp->nhp_##pref) : ((void*) 0)) |
| 1644 | TAG(nhp->nhp_set.nhb_##pref && nhp->nhp_##pref \!(nhp->nhp_set_.set_bits.nhb_##pref) ? tag_skip : TAG(nhp-> nhp_set_.set_bits.nhb_##pref && nhp->nhp_##pref ? sip_ ##pref##_make(tmphome, (char *)nhp->nhp_##pref) : ((void*) 0)) |
| 1645 | ? sip_##pref##_make(tmphome, (char *)nhp->nhp_##pref) \!(nhp->nhp_set_.set_bits.nhb_##pref) ? tag_skip : TAG(nhp-> nhp_set_.set_bits.nhb_##pref && nhp->nhp_##pref ? sip_ ##pref##_make(tmphome, (char *)nhp->nhp_##pref) : ((void*) 0)) |
| 1646 | : NULL))!(nhp->nhp_set_.set_bits.nhb_##pref) ? tag_skip : TAG(nhp-> nhp_set_.set_bits.nhb_##pref && nhp->nhp_##pref ? sip_ ##pref##_make(tmphome, (char *)nhp->nhp_##pref) : ((void*) 0)) |
| 1647 | |
| 1648 | if (nh != dnh && nhp == dnh->nh_prefs) |
| 1649 | nhp = nhp_zero; |
| 1650 | |
| 1651 | su_home_auto(tmphome, sizeof(tmphome)); |
| 1652 | |
| 1653 | lst = tl_filtered_tlist |
| 1654 | (tmphome, tags, |
| 1655 | TAG_IF(has_from, SIPTAG_FROM(from))!(has_from) ? tag_skip : siptag_from, siptag_from_v(from), |
| 1656 | TAG_IF(has_from,!(has_from) ? tag_skip : siptag_from_str, tag_str_v(has_from ? sip_header_as_string(tmphome, (void *)from) : ((void*)0)) |
| 1657 | SIPTAG_FROM_STR(has_from!(has_from) ? tag_skip : siptag_from_str, tag_str_v(has_from ? sip_header_as_string(tmphome, (void *)from) : ((void*)0)) |
| 1658 | ? sip_header_as_string(tmphome, (void *)from)!(has_from) ? tag_skip : siptag_from_str, tag_str_v(has_from ? sip_header_as_string(tmphome, (void *)from) : ((void*)0)) |
| 1659 | : NULL))!(has_from) ? tag_skip : siptag_from_str, tag_str_v(has_from ? sip_header_as_string(tmphome, (void *)from) : ((void*)0)), |
| 1660 | |
| 1661 | TIF(NUTAG_RETRY_COUNT, retry_count)!(nhp->nhp_set_.set_bits.nhb_retry_count) ? tag_skip : nutag_retry_count , tag_uint_v(nhp->nhp_retry_count), |
| 1662 | TIF(NUTAG_MAX_SUBSCRIPTIONS, max_subscriptions)!(nhp->nhp_set_.set_bits.nhb_max_subscriptions) ? tag_skip : nutag_max_subscriptions, tag_uint_v(nhp->nhp_max_subscriptions ), |
| 1663 | |
| 1664 | TIF(NUTAG_SOA_NAME, soa_name)!(nhp->nhp_set_.set_bits.nhb_soa_name) ? tag_skip : nutag_soa_name , tag_str_v(nhp->nhp_soa_name), |
| 1665 | TIF(NUTAG_MEDIA_ENABLE, media_enable)!(nhp->nhp_set_.set_bits.nhb_media_enable) ? tag_skip : nutag_media_enable , tag_bool_v(nhp->nhp_media_enable), |
| 1666 | TIF(NUTAG_ENABLEINVITE, invite_enable)!(nhp->nhp_set_.set_bits.nhb_invite_enable) ? tag_skip : nutag_enableinvite , tag_bool_v(nhp->nhp_invite_enable), |
| 1667 | TIF(NUTAG_AUTOALERT, auto_alert)!(nhp->nhp_set_.set_bits.nhb_auto_alert) ? tag_skip : nutag_autoalert , tag_bool_v(nhp->nhp_auto_alert), |
| 1668 | TIF(NUTAG_EARLY_ANSWER, early_answer)!(nhp->nhp_set_.set_bits.nhb_early_answer) ? tag_skip : nutag_early_answer , tag_bool_v(nhp->nhp_early_answer), |
| 1669 | TIF(NUTAG_EARLY_MEDIA, early_media)!(nhp->nhp_set_.set_bits.nhb_early_media) ? tag_skip : nutag_early_media , tag_bool_v(nhp->nhp_early_media), |
| 1670 | TIF(NUTAG_ONLY183_100REL, only183_100rel)!(nhp->nhp_set_.set_bits.nhb_only183_100rel) ? tag_skip : nutag_only183_100rel , tag_bool_v(nhp->nhp_only183_100rel), |
| 1671 | TIF(NUTAG_AUTOANSWER, auto_answer)!(nhp->nhp_set_.set_bits.nhb_auto_answer) ? tag_skip : nutag_autoanswer , tag_bool_v(nhp->nhp_auto_answer), |
| 1672 | TIF(NUTAG_AUTOACK, auto_ack)!(nhp->nhp_set_.set_bits.nhb_auto_ack) ? tag_skip : nutag_autoack , tag_bool_v(nhp->nhp_auto_ack), |
| 1673 | TIF(NUTAG_TIMER_AUTOREQUIRE, timer_autorequire)!(nhp->nhp_set_.set_bits.nhb_timer_autorequire) ? tag_skip : nutag_timer_autorequire, tag_bool_v(nhp->nhp_timer_autorequire ), |
| 1674 | TIF(NUTAG_INVITE_TIMER, invite_timeout)!(nhp->nhp_set_.set_bits.nhb_invite_timeout) ? tag_skip : nutag_invite_timer , tag_uint_v((nhp->nhp_invite_timeout)), |
| 1675 | |
| 1676 | TIFD(NUTAG_SESSION_TIMER, session_timer)!(nh == dnh || nhp->nhp_set_.set_bits.nhb_session_timer) ? tag_skip : nutag_session_timer, tag_uint_v((nhp->nhp_session_timer )), |
| 1677 | TIF(NUTAG_MIN_SE, min_se)!(nhp->nhp_set_.set_bits.nhb_min_se) ? tag_skip : nutag_min_se , tag_uint_v((nhp->nhp_min_se)), |
| 1678 | TIFD(NUTAG_SESSION_REFRESHER, refresher)!(nh == dnh || nhp->nhp_set_.set_bits.nhb_refresher) ? tag_skip : nutag_session_refresher, tag_int_v((nhp->nhp_refresher) ), |
| 1679 | TIF(NUTAG_UPDATE_REFRESH, update_refresh)!(nhp->nhp_set_.set_bits.nhb_update_refresh) ? tag_skip : nutag_update_refresh , tag_bool_v((nhp->nhp_update_refresh)), |
| 1680 | TIF(NUTAG_REFRESH_WITHOUT_SDP, refresh_without_sdp)!(nhp->nhp_set_.set_bits.nhb_refresh_without_sdp) ? tag_skip : nutag_refresh_without_sdp, tag_bool_v((nhp->nhp_refresh_without_sdp )), |
| 1681 | |
| 1682 | TIF(NUTAG_ENABLEMESSAGE, message_enable)!(nhp->nhp_set_.set_bits.nhb_message_enable) ? tag_skip : nutag_enablemessage , tag_bool_v(nhp->nhp_message_enable), |
| 1683 | TIF(NUTAG_ENABLEMESSENGER, win_messenger_enable)!(nhp->nhp_set_.set_bits.nhb_win_messenger_enable) ? tag_skip : nutag_enablemessenger, tag_bool_v(nhp->nhp_win_messenger_enable ), |
| 1684 | /* TIF(NUTAG_AUTORESPOND, autorespond), */ |
| 1685 | |
| 1686 | TIF(NUTAG_CALLEE_CAPS, callee_caps)!(nhp->nhp_set_.set_bits.nhb_callee_caps) ? tag_skip : nutag_callee_caps , tag_bool_v(nhp->nhp_callee_caps), |
| 1687 | TIF(NUTAG_MEDIA_FEATURES, media_features)!(nhp->nhp_set_.set_bits.nhb_media_features) ? tag_skip : nutag_media_features , tag_bool_v(nhp->nhp_media_features), |
| 1688 | TIF(NUTAG_SERVICE_ROUTE_ENABLE, service_route_enable)!(nhp->nhp_set_.set_bits.nhb_service_route_enable) ? tag_skip : nutag_service_route_enable, tag_bool_v(nhp->nhp_service_route_enable ), |
| 1689 | TIF(NUTAG_PATH_ENABLE, path_enable)!(nhp->nhp_set_.set_bits.nhb_path_enable) ? tag_skip : nutag_path_enable , tag_bool_v(nhp->nhp_path_enable), |
| 1690 | TIF(NUTAG_RETRY_AFTER_ENABLE, retry_after_enable)!(nhp->nhp_set_.set_bits.nhb_retry_after_enable) ? tag_skip : nutag_retry_after_enable, tag_bool_v(nhp->nhp_retry_after_enable ), |
| 1691 | TIF(NUTAG_AUTH_CACHE, auth_cache)!(nhp->nhp_set_.set_bits.nhb_auth_cache) ? tag_skip : nutag_auth_cache , tag_int_v(nhp->nhp_auth_cache), |
| 1692 | TIF(NUTAG_REFER_EXPIRES, refer_expires)!(nhp->nhp_set_.set_bits.nhb_refer_expires) ? tag_skip : nutag_refer_expires , tag_uint_v((nhp->nhp_refer_expires)), |
| 1693 | TIF(NUTAG_REFER_WITH_ID, refer_with_id)!(nhp->nhp_set_.set_bits.nhb_refer_with_id) ? tag_skip : nutag_refer_with_id , tag_bool_v(nhp->nhp_refer_with_id), |
| 1694 | |
| 1695 | TIF(NUTAG_SUBSTATE, substate)!(nhp->nhp_set_.set_bits.nhb_substate) ? tag_skip : nutag_substate , tag_int_v(nhp->nhp_substate), |
| 1696 | TIF(NUTAG_SUB_EXPIRES, sub_expires)!(nhp->nhp_set_.set_bits.nhb_sub_expires) ? tag_skip : nutag_sub_expires , tag_uint_v(nhp->nhp_sub_expires), |
| 1697 | |
| 1698 | TIF(SIPTAG_SUPPORTED, supported)!(nhp->nhp_set_.set_bits.nhb_supported) ? tag_skip : siptag_supported , siptag_supported_v(nhp->nhp_supported), |
| 1699 | TIF_STR(SIPTAG_SUPPORTED_STR, supported)!(nhp->nhp_set_.set_bits.nhb_supported) ? tag_skip : siptag_supported_str , tag_str_v(nhp->nhp_set_.set_bits.nhb_supported && nhp->nhp_supported ? sip_header_as_string(tmphome, (void * )nhp->nhp_supported) : ((void*)0)), |
| 1700 | TIF(SIPTAG_ALLOW, allow)!(nhp->nhp_set_.set_bits.nhb_allow) ? tag_skip : siptag_allow , siptag_allow_v(nhp->nhp_allow), |
| 1701 | TIF_STR(SIPTAG_ALLOW_STR, allow)!(nhp->nhp_set_.set_bits.nhb_allow) ? tag_skip : siptag_allow_str , tag_str_v(nhp->nhp_set_.set_bits.nhb_allow && nhp ->nhp_allow ? sip_header_as_string(tmphome, (void *)nhp-> nhp_allow) : ((void*)0)), |
| 1702 | TIF_STR(NUTAG_APPL_METHOD, appl_method)!(nhp->nhp_set_.set_bits.nhb_appl_method) ? tag_skip : nutag_appl_method , tag_str_v(nhp->nhp_set_.set_bits.nhb_appl_method && nhp->nhp_appl_method ? sip_header_as_string(tmphome, (void *)nhp->nhp_appl_method) : ((void*)0)), |
| 1703 | TIF(SIPTAG_ALLOW_EVENTS, allow_events)!(nhp->nhp_set_.set_bits.nhb_allow_events) ? tag_skip : siptag_allow_events , siptag_allow_events_v(nhp->nhp_allow_events), |
| 1704 | TIF_STR(SIPTAG_ALLOW_EVENTS_STR, allow_events)!(nhp->nhp_set_.set_bits.nhb_allow_events) ? tag_skip : siptag_allow_events_str , tag_str_v(nhp->nhp_set_.set_bits.nhb_allow_events && nhp->nhp_allow_events ? sip_header_as_string(tmphome, (void *)nhp->nhp_allow_events) : ((void*)0)), |
| 1705 | TIF_SIP(SIPTAG_USER_AGENT, user_agent)!(nhp->nhp_set_.set_bits.nhb_user_agent) ? tag_skip : siptag_user_agent , siptag_user_agent_v(nhp->nhp_set_.set_bits.nhb_user_agent && nhp->nhp_user_agent ? sip_user_agent_make(tmphome , (char *)nhp->nhp_user_agent) : ((void*)0)), |
| 1706 | TIF(SIPTAG_USER_AGENT_STR, user_agent)!(nhp->nhp_set_.set_bits.nhb_user_agent) ? tag_skip : siptag_user_agent_str , tag_str_v(nhp->nhp_user_agent), |
| 1707 | TIF(NUTAG_USER_AGENT, user_agent)!(nhp->nhp_set_.set_bits.nhb_user_agent) ? tag_skip : nutag_user_agent , tag_str_v(nhp->nhp_user_agent), |
| 1708 | |
| 1709 | TIF_SIP(SIPTAG_ORGANIZATION, organization)!(nhp->nhp_set_.set_bits.nhb_organization) ? tag_skip : siptag_organization , siptag_organization_v(nhp->nhp_set_.set_bits.nhb_organization && nhp->nhp_organization ? sip_organization_make( tmphome, (char *)nhp->nhp_organization) : ((void*)0)), |
| 1710 | TIF(SIPTAG_ORGANIZATION_STR, organization)!(nhp->nhp_set_.set_bits.nhb_organization) ? tag_skip : siptag_organization_str , tag_str_v(nhp->nhp_organization), |
| 1711 | |
| 1712 | TIF_SIP(SIPTAG_VIA, via)!(nhp->nhp_set_.set_bits.nhb_via) ? tag_skip : siptag_via, siptag_via_v(nhp->nhp_set_.set_bits.nhb_via && nhp ->nhp_via ? sip_via_make(tmphome, (char *)nhp->nhp_via) : ((void*)0)), |
| 1713 | TIF(SIPTAG_VIA_STR, via)!(nhp->nhp_set_.set_bits.nhb_via) ? tag_skip : siptag_via_str , tag_str_v(nhp->nhp_via), |
| 1714 | |
| 1715 | TIF(NUTAG_INITIAL_ROUTE, initial_route)!(nhp->nhp_set_.set_bits.nhb_initial_route) ? tag_skip : nutag_initial_route , siptag_route_v(nhp->nhp_initial_route), |
| 1716 | TIF_STR(NUTAG_INITIAL_ROUTE_STR, initial_route)!(nhp->nhp_set_.set_bits.nhb_initial_route) ? tag_skip : nutag_initial_route_str , tag_str_v(nhp->nhp_set_.set_bits.nhb_initial_route && nhp->nhp_initial_route ? sip_header_as_string(tmphome, (void *)nhp->nhp_initial_route) : ((void*)0)), |
| 1717 | |
| 1718 | TIF(NUTAG_REGISTRAR, registrar)!(nhp->nhp_set_.set_bits.nhb_registrar) ? tag_skip : nutag_registrar , urltag_url_v(nhp->nhp_registrar), |
| 1719 | TIF(NUTAG_KEEPALIVE, keepalive)!(nhp->nhp_set_.set_bits.nhb_keepalive) ? tag_skip : nutag_keepalive , tag_uint_v(nhp->nhp_keepalive), |
| 1720 | TIF(NUTAG_KEEPALIVE_STREAM, keepalive_stream)!(nhp->nhp_set_.set_bits.nhb_keepalive_stream) ? tag_skip : nutag_keepalive_stream, tag_uint_v(nhp->nhp_keepalive_stream ), |
| 1721 | |
| 1722 | TIF(NUTAG_INSTANCE, instance)!(nhp->nhp_set_.set_bits.nhb_instance) ? tag_skip : nutag_instance , tag_str_v(nhp->nhp_instance), |
| 1723 | TIF(NUTAG_M_DISPLAY, m_display)!(nhp->nhp_set_.set_bits.nhb_m_display) ? tag_skip : nutag_m_display , tag_str_v(nhp->nhp_m_display), |
| 1724 | TIF(NUTAG_M_USERNAME, m_username)!(nhp->nhp_set_.set_bits.nhb_m_username) ? tag_skip : nutag_m_username , tag_str_v(nhp->nhp_m_username), |
| 1725 | TIF(NUTAG_M_PARAMS, m_params)!(nhp->nhp_set_.set_bits.nhb_m_params) ? tag_skip : nutag_m_params , tag_str_v(nhp->nhp_m_params), |
| 1726 | TIF(NUTAG_M_FEATURES, m_features)!(nhp->nhp_set_.set_bits.nhb_m_features) ? tag_skip : nutag_m_features , tag_str_v(nhp->nhp_m_features), |
| 1727 | TIF(NUTAG_OUTBOUND, outbound)!(nhp->nhp_set_.set_bits.nhb_outbound) ? tag_skip : nutag_outbound , tag_str_v(nhp->nhp_outbound), |
| 1728 | |
| 1729 | /* Handle-specific proxy */ |
| 1730 | TAG_IF(nh != dnh && nhp->nhp_set.nhb_proxy,!(nh != dnh && nhp->nhp_set_.set_bits.nhb_proxy) ? tag_skip : ntatag_default_proxy, urltag_url_v((nhp->nhp_proxy )) |
| 1731 | NUTAG_PROXY(nhp->nhp_proxy))!(nh != dnh && nhp->nhp_set_.set_bits.nhb_proxy) ? tag_skip : ntatag_default_proxy, urltag_url_v((nhp->nhp_proxy )), |
| 1732 | |
| 1733 | /* Skip user-agent-level parameters if parameters are for handle only */ |
| 1734 | TAG_IF(nh != dnh, TAG_NEXT(media_params))!(nh != dnh) ? tag_skip : tag_next, (tag_value_t)(media_params ), |
| 1735 | |
| 1736 | /* Include tag in the list returned to user |
| 1737 | * if it has been earlier set (by user) */ |
| 1738 | #define GIF(TAG, pref)!(ngp->ngp_set_.set_bits.ngp_pref) ? tag_skip : TAG(ngp-> ngp_pref) \ |
| 1739 | TAG_IF(ngp->ngp_set.ngp_##pref, TAG(ngp->ngp_##pref))!(ngp->ngp_set_.set_bits.ngp_##pref) ? tag_skip : TAG(ngp-> ngp_##pref) |
| 1740 | |
| 1741 | GIF(NUTAG_DETECT_NETWORK_UPDATES, detect_network_updates)!(ngp->ngp_set_.set_bits.ngp_detect_network_updates) ? tag_skip : nutag_detect_network_updates, tag_int_v(ngp->ngp_detect_network_updates ), |
| 1742 | GIF(NUTAG_SHUTDOWN_EVENTS, shutdown_events)!(ngp->ngp_set_.set_bits.ngp_shutdown_events) ? tag_skip : nutag_shutdown_events, tag_bool_v(ngp->ngp_shutdown_events ), |
| 1743 | |
| 1744 | NTATAG_CONTACT(m)ntatag_contact, siptag_contact_v((m)), |
| 1745 | |
| 1746 | #if HAVE_SOFIA_SMIME0 |
| 1747 | NUTAG_SMIME_ENABLE(nua->sm->sm_enable)nutag_smime_enable, tag_bool_v(nua->sm->sm_enable), |
| 1748 | NUTAG_SMIME_OPT(nua->sm->sm_opt)nutag_smime_opt, tag_int_v(nua->sm->sm_opt), |
| 1749 | NUTAG_SMIME_PROTECTION_MODE(nua->sm->sm_protection_mode)nutag_smime_protection_mode, tag_uint_v(nua->sm->sm_protection_mode ), |
| 1750 | NUTAG_SMIME_MESSAGE_DIGEST(nua->sm->sm_message_digest)nutag_smime_message_digest, tag_str_v(nua->sm->sm_message_digest ), |
| 1751 | NUTAG_SMIME_SIGNATURE(nua->sm->sm_signature)nutag_smime_signature, tag_str_v(nua->sm->sm_signature), |
| 1752 | NUTAG_SMIME_KEY_ENCRYPTION(nua->sm->sm_key_encryption)nutag_smime_key_encryption, tag_str_v(nua->sm->sm_key_encryption ), |
| 1753 | NUTAG_SMIME_MESSAGE_ENCRYPTION(nua->sm->sm_message_encryption)nutag_smime_message_encryption, tag_str_v(nua->sm->sm_message_encryption ), |
| 1754 | #endif |
| 1755 | |
| 1756 | NTATAG_UDP_MTU(udp_mtu)ntatag_udp_mtu, tag_uint_v((udp_mtu)), |
| 1757 | NTATAG_MAX_PROCEEDING(max_proceeding)ntatag_max_proceeding, tag_usize_v((max_proceeding)), |
| 1758 | NTATAG_SIP_T1(sip_t1)ntatag_sip_t1, tag_uint_v((sip_t1)), |
| 1759 | NTATAG_SIP_T2(sip_t2)ntatag_sip_t2, tag_uint_v((sip_t2)), |
| 1760 | NTATAG_SIP_T4(sip_t4)ntatag_sip_t4, tag_uint_v((sip_t4)), |
| 1761 | NTATAG_SIP_T1X64(sip_t1x64)ntatag_sip_t1x64, tag_uint_v((sip_t1x64)), |
| 1762 | NTATAG_DEBUG_DROP_PROB(debug_drop_prob)ntatag_debug_drop_prob, tag_uint_v((debug_drop_prob)), |
| 1763 | /* Stack-wide proxy */ |
| 1764 | NTATAG_DEFAULT_PROXY(proxy)ntatag_default_proxy, urltag_url_v((proxy)), |
| 1765 | NTATAG_ALIASES(aliases)ntatag_aliases, siptag_contact_v((aliases)), |
| 1766 | NTATAG_SIPFLAGS(flags)ntatag_sipflags, tag_uint_v((flags)), |
| 1767 | |
| 1768 | TAG_NEXT(media_params)tag_next, (tag_value_t)(media_params)); |
| 1769 | |
| 1770 | nua_stack_event(nua, nh, NULL((void*)0), nua_r_get_params, SIP_200_OK200, sip_200_OK, lst); |
| 1771 | |
| 1772 | su_home_deinit(tmphome); |
| 1773 | |
| 1774 | tl_vfree(media_params); |
| 1775 | |
| 1776 | return 0; |
| 1777 | } |