| 98 | |
| 99 | |
| 100 | static inline int pre_print_uac_request( struct cell *t, int branch, |
| 101 | struct sip_msg *request, struct sip_msg_body **body_clone) |
| 102 | { |
| 103 | int backup_route_type; |
| 104 | struct usr_avp **backup_list; |
| 105 | char *p; |
| 106 | struct ua_client* uac = & TM_BRANCH( t, branch); |
| 107 | |
| 108 | /* ... we calculate branch ... */ |
| 109 | if (!t_calc_branch(t, branch, request->add_to_branch_s, |
| 110 | &request->add_to_branch_len )) |
| 111 | { |
| 112 | LM_ERR("branch computation failed\n"); |
| 113 | goto error; |
| 114 | } |
| 115 | |
| 116 | /* from now on, flag all new lumps with LUMPFLAG_BRANCH flag in order to |
| 117 | * be able to remove them later --bogdan */ |
| 118 | set_init_lump_flags(LUMPFLAG_BRANCH); |
| 119 | |
| 120 | /* copy path vector into branch */ |
| 121 | if (request->path_vec.len) { |
| 122 | uac->path_vec.s = |
| 123 | shm_realloc(uac->path_vec.s, request->path_vec.len+1); |
| 124 | if (uac->path_vec.s==NULL) { |
| 125 | LM_ERR("shm_realloc failed\n"); |
| 126 | goto error; |
| 127 | } |
| 128 | uac->path_vec.len = request->path_vec.len; |
| 129 | memcpy( uac->path_vec.s, request->path_vec.s, |
| 130 | request->path_vec.len+1); |
| 131 | } |
| 132 | |
| 133 | /* do the same for the advertised port & address */ |
| 134 | if (request->set_global_address.len) { |
| 135 | uac->adv_address.s = shm_realloc(uac->adv_address.s, |
| 136 | request->set_global_address.len+1); |
| 137 | if (uac->adv_address.s==NULL) { |
| 138 | LM_ERR("shm_realloc failed for storing the advertised address " |
| 139 | "(len=%d)\n",request->set_global_address.len); |
| 140 | goto error; |
| 141 | } |
| 142 | uac->adv_address.len = request->set_global_address.len; |
| 143 | memcpy( uac->adv_address.s, request->set_global_address.s, |
| 144 | request->set_global_address.len+1); |
| 145 | } |
| 146 | if (request->set_global_port.len) { |
| 147 | uac->adv_port.s = shm_realloc(uac->adv_port.s, |
| 148 | request->set_global_port.len+1); |
| 149 | if (uac->adv_port.s==NULL) { |
| 150 | LM_ERR("shm_realloc failed for storing the advertised port " |
| 151 | "(len=%d)\n",request->set_global_port.len); |
| 152 | goto error; |
| 153 | } |
| 154 | uac->adv_port.len = request->set_global_port.len; |
| 155 | memcpy( uac->adv_port.s, request->set_global_port.s, |
| 156 | request->set_global_port.len+1); |
| 157 | } |
no test coverage detected