From 7023ec8f1d174a05bacb460025761668202dde1b Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Tue, 16 Apr 2019 13:52:37 +0300 Subject: [PATCH] Fix order of params in t_relay() --- modules/tm/doc/tm_admin.xml | 46 ++++++++---------------- modules/tm/tm.c | 71 +++---------------------------------- 2 files changed, 19 insertions(+), 98 deletions(-) diff --git a/modules/tm/doc/tm_admin.xml b/modules/tm/doc/tm_admin.xml index 1b1883841a2..6982c16e7db 100644 --- a/modules/tm/doc/tm_admin.xml +++ b/modules/tm/doc/tm_admin.xml @@ -868,7 +868,7 @@ modparam("tm", "cluster_auto_cancel", no) Exported Functions
- <function moreinfo="none">t_relay([flags])</function> + <function moreinfo="none">t_relay([flags],[outbound_proxy])</function> Relay a message statefully to destination indicated in current URI. @@ -882,7 +882,10 @@ modparam("tm", "cluster_auto_cancel", no) yet created, the function will automatically create it. - The function may take as parameter an optional set of flags for + The function may take two optional parameters. + + + The first parameter is a number representing a set of flags for controlling the internal behaviour. The flags may be given in decimal or hexa format; supported flags are: @@ -935,6 +938,14 @@ modparam("tm", "cluster_auto_cancel", no) + The second parameter is a string representing an outbound proxy + (a fixed destination) where the message should be sent. The + destination is specified as [proto:]host[:port]. If a + destination URI $du for this message was set before the + function is called then this value will be used as the destination + instead of the function parameter. + + In case of error, the function returns the following codes: @@ -978,36 +989,9 @@ if (!t_relay()) { exit; } ... - - -
- -
- - <function moreinfo="none">t_relay(proto:host:port,[flags])</function> - - - Relay a message statefully to a fixed destination. The destination is - specified as [proto:]host[:port]. If a destination URI - $du for this message was set before the function - is called then this value will be used as the destination instead of the - function parameter. - - - The function may take as parameter an optional set of flags for - controlling the internal behaviour - for details see the above - t_relay([flags]) function. - - - This functions can be used from REQUEST_ROUTE, FAILURE_ROUTE. - - - <function>t_relay</function> usage - +t_relay( ,"tcp:192.168.1.10:5060"); ... -t_relay("tcp:192.168.1.10:5060"); -t_relay("mydomain.com:5070","0x1"); -t_relay("udp:mydomain.com"); +t_relay("0x1", "mydomain.com:5070"); ... diff --git a/modules/tm/tm.c b/modules/tm/tm.c index 5cf35516eba..cd7278659a4 100644 --- a/modules/tm/tm.c +++ b/modules/tm/tm.c @@ -188,69 +188,6 @@ static dep_export_t deps = { }, }; -// static cmd_export_t cmds[]={ -// {"t_newtran", (cmd_function)w_t_newtran, 0, 0, -// 0, REQUEST_ROUTE}, -// {"t_reply", (cmd_function)w_pv_t_reply, 2, fixup_t_send_reply, -// 0, REQUEST_ROUTE | FAILURE_ROUTE }, -// {"t_replicate", (cmd_function)w_t_replicate, 1, fixup_t_replicate, -// 0, REQUEST_ROUTE}, -// {"t_replicate", (cmd_function)w_t_replicate, 2, fixup_t_replicate, -// 0, REQUEST_ROUTE}, -// {"t_relay", (cmd_function)w_t_relay, 0, 0, -// 0, REQUEST_ROUTE | FAILURE_ROUTE }, -// {"t_relay", (cmd_function)w_t_relay, 1, fixup_t_relay1, -// 0, REQUEST_ROUTE | FAILURE_ROUTE }, -// {"t_relay", (cmd_function)w_t_relay, 2, fixup_t_relay2, -// 0, REQUEST_ROUTE | FAILURE_ROUTE }, -// {"t_on_failure", (cmd_function)w_t_on_negative, 1, fixup_froute, -// 0, REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -// {"t_on_reply", (cmd_function)w_t_on_reply, 1, fixup_rroute, -// 0, REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -// {"t_on_branch", (cmd_function)w_t_on_branch, 1, fixup_broute, -// 0, REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE | BRANCH_ROUTE }, -// {"t_check_status", (cmd_function)t_check_status, 1, fixup_regexp_null, -// 0, REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE | BRANCH_ROUTE }, -// {"t_write_req", (cmd_function)t_write_req, 2, fixup_t_write, -// 0, REQUEST_ROUTE | FAILURE_ROUTE | BRANCH_ROUTE }, -// {"t_write_unix", (cmd_function)t_write_unix, 2, fixup_t_write, -// 0, REQUEST_ROUTE | FAILURE_ROUTE | BRANCH_ROUTE }, -// {"t_flush_flags", (cmd_function)t_flush_flags, 0, 0, -// 0, REQUEST_ROUTE | BRANCH_ROUTE }, -// {"t_local_replied", (cmd_function)t_local_replied, 1, fixup_local_replied, -// 0, REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE | BRANCH_ROUTE }, -// {"t_check_trans", (cmd_function)t_check_trans, 0, 0, -// 0, REQUEST_ROUTE | BRANCH_ROUTE }, -// {"t_was_cancelled", (cmd_function)t_was_cancelled, 0, 0, -// 0, FAILURE_ROUTE | ONREPLY_ROUTE }, -// {"t_cancel_branch", (cmd_function)w_t_cancel_branch,0, 0, -// 0, ONREPLY_ROUTE }, -// {"t_cancel_branch", (cmd_function)w_t_cancel_branch,1, fixup_cancel_branch, -// 0, ONREPLY_ROUTE }, -// {"t_add_hdrs", (cmd_function)w_t_add_hdrs, 1, fixup_spve_null, -// 0, REQUEST_ROUTE }, -// {"t_reply_with_body",(cmd_function)w_t_reply_body, 3,fixup_t_send_reply, -// 0, REQUEST_ROUTE }, -// {"t_new_request", (cmd_function)w_t_new_request, 4, fixup_t_new_request, -// 0, REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -// {"t_new_request", (cmd_function)w_t_new_request, 5, fixup_t_new_request, -// 0, REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -// {"t_new_request", (cmd_function)w_t_new_request, 6, fixup_t_new_request, -// 0, REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -// {"t_add_cancel_reason",(cmd_function)t_add_reason, 1, fixup_spve_null, -// 0, REQUEST_ROUTE}, -// {"t_inject_branches",(cmd_function)w_t_inject_branches,1,fixup_inject, -// 0, REQUEST_ROUTE|ONREPLY_ROUTE}, -// {"t_inject_branches",(cmd_function)w_t_inject_branches,2,fixup_inject, -// 0, REQUEST_ROUTE|ONREPLY_ROUTE}, -// {"t_wait_for_new_branches",(cmd_function)w_t_wait_for_new_branches,0, 0, -// 0, REQUEST_ROUTE}, -// {"t_anycast_replicate", (cmd_function)tm_anycast_replicate, 0, 0, -// 0, REQUEST_ROUTE}, -// {"load_tm", (cmd_function)load_tm, 0, 0, -// 0, 0}, -// {0,0,0,0,0,0} -// }; static cmd_export_t cmds[]={ {"t_newtran", (cmd_function)w_t_newtran, {{0,0,0}}, @@ -264,8 +201,8 @@ static cmd_export_t cmds[]={ {CMD_PARAM_INT | CMD_PARAM_OPT, flag_fixup, 0}, {0,0,0}}, REQUEST_ROUTE | FAILURE_ROUTE}, {"t_relay", (cmd_function)w_t_relay, { - {CMD_PARAM_STR | CMD_PARAM_OPT, fixup_phostport2proxy, fixup_free_proxy}, - {CMD_PARAM_INT | CMD_PARAM_OPT, flag_fixup, 0}, {0,0,0}}, + {CMD_PARAM_INT|CMD_PARAM_OPT, flag_fixup, 0}, {0,0,0}, + {CMD_PARAM_STR|CMD_PARAM_OPT, fixup_phostport2proxy,fixup_free_proxy}}, REQUEST_ROUTE | FAILURE_ROUTE}, {"t_on_failure", (cmd_function)w_t_on_negative, { {CMD_PARAM_STR, fixup_froute, 0}, {0,0,0}}, @@ -322,8 +259,8 @@ static cmd_export_t cmds[]={ {CMD_PARAM_STR, fixup_inject_source, 0}, {CMD_PARAM_STR | CMD_PARAM_OPT, fixup_inject_flags, 0}, {0,0,0}}, REQUEST_ROUTE|ONREPLY_ROUTE}, - {"t_wait_for_new_branches", (cmd_function)w_t_wait_for_new_branches, {{0,0,0}}, - REQUEST_ROUTE}, + {"t_wait_for_new_branches", (cmd_function)w_t_wait_for_new_branches, + {{0,0,0}},REQUEST_ROUTE}, {"t_anycast_replicate", (cmd_function)tm_anycast_replicate, {{0,0,0}}, REQUEST_ROUTE}, {"load_tm", (cmd_function)load_tm, {{0,0,0}}, 0},