| 1660 | |
| 1661 | |
| 1662 | int w_t_inject_branches(struct sip_msg* msg, void *source, void *extra_flags) |
| 1663 | { |
| 1664 | struct cell *t; |
| 1665 | int is_local=0; |
| 1666 | int rc; |
| 1667 | int flags = ((int)(long)source) | ((int)(long)extra_flags); |
| 1668 | |
| 1669 | /* first get the transaction */ |
| 1670 | t = get_t(); |
| 1671 | if (t!=T_NULL_CELL && t!=T_UNDEFINED) { |
| 1672 | /* there is a T in the local processing, use it */ |
| 1673 | is_local = 1; |
| 1674 | } else { |
| 1675 | /* no T in this context, look for an remote T ID*/ |
| 1676 | if (remote_T==NULL) { |
| 1677 | LM_DBG("no transaction (local or remote) to be used\n"); |
| 1678 | return -1; |
| 1679 | } |
| 1680 | if (remote_T->hash==0 && remote_T->label==0) { |
| 1681 | LM_BUG("invalid T ID (bad hexa %d,%d) found in remote_T\n", |
| 1682 | remote_T->hash, remote_T->label); |
| 1683 | return -1; |
| 1684 | } |
| 1685 | /* get the remote transaction */ |
| 1686 | if (t_lookup_ident( &t, remote_T->hash, remote_T->label)<0) { |
| 1687 | LM_DBG("transaction %u:%u not found anymore\n", |
| 1688 | remote_T->hash, remote_T->label); |
| 1689 | return -1; |
| 1690 | } |
| 1691 | /* remember that this trasaction is ref++ by us !! */ |
| 1692 | } |
| 1693 | |
| 1694 | if (!is_local) |
| 1695 | LOCK_REPLIES(t); |
| 1696 | |
| 1697 | /* we have the transaction to operate with, do the stuff now */ |
| 1698 | rc = t_inject_branch( t, msg, flags); |
| 1699 | |
| 1700 | if (!is_local) { |
| 1701 | UNLOCK_REPLIES(t); |
| 1702 | UNREF(t); |
| 1703 | set_t(NULL); |
| 1704 | } |
| 1705 | |
| 1706 | return rc; |
| 1707 | } |
| 1708 | |
| 1709 | |
| 1710 | int w_t_wait_for_new_branches(struct sip_msg* msg, unsigned int br_to_wait) |
no test coverage detected