copies and fills in a branch_wrap with the values from a msg_branch * IMPORTANT: if any attrs are attached the `branch`, they will be moved * into the dset!!! */
| 205 | * IMPORTANT: if any attrs are attached the `branch`, they will be moved |
| 206 | * into the dset!!! */ |
| 207 | static inline int _set_msg_branch(struct msg_branch_wrap *br, |
| 208 | struct msg_branch *branch) |
| 209 | { |
| 210 | /* be sure and clear the attrs from target branch */ |
| 211 | destroy_avp_list( &br->branch.attrs ); |
| 212 | |
| 213 | /* do full copy, copy the buffers later */ |
| 214 | br->branch = *branch; |
| 215 | |
| 216 | /* copy ruri */ |
| 217 | if (ZSTR(branch->uri) || branch->uri.len > MAX_URI_SIZE - 1) { |
| 218 | LM_ERR("too long uri: [%.*s]/%d\n", branch->uri.len, branch->uri.s, |
| 219 | branch->uri.len); |
| 220 | return -1; |
| 221 | } |
| 222 | br->branch.uri.s = br->uri; |
| 223 | memcpy( br->branch.uri.s, branch->uri.s, branch->uri.len); |
| 224 | |
| 225 | /* copy the dst_uri */ |
| 226 | if (!ZSTR(branch->dst_uri)) { |
| 227 | if (branch->dst_uri.len > MAX_URI_SIZE - 1) { |
| 228 | LM_ERR("too long dst_uri: [%.*s]/%d\n", |
| 229 | branch->dst_uri.len, branch->dst_uri.s, branch->dst_uri.len); |
| 230 | return -1; |
| 231 | } |
| 232 | br->branch.dst_uri.s = br->dst_uri; |
| 233 | memcpy( br->branch.dst_uri.s, branch->dst_uri.s, branch->dst_uri.len); |
| 234 | } |
| 235 | |
| 236 | /* copy the path string */ |
| 237 | if (!ZSTR(branch->path)) { |
| 238 | if (branch->path.len > MAX_PATH_SIZE - 1) { |
| 239 | LM_ERR("too long path: [%.*s]/%d\n", |
| 240 | branch->path.len, branch->path.s, branch->path.len); |
| 241 | return -1; |
| 242 | } |
| 243 | br->branch.path.s = br->path; |
| 244 | memcpy( br->branch.path.s, branch->path.s, branch->path.len); |
| 245 | } |
| 246 | return 0; |
| 247 | } |
| 248 | |
| 249 | |
| 250 | static inline int _dst_malloc(struct dset_ctx **dsct) |
no test coverage detected