Skip to content

Commit

Permalink
Fix order of params in t_relay()
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-iancu committed Apr 16, 2019
1 parent b6a887b commit 7023ec8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 98 deletions.
46 changes: 15 additions & 31 deletions modules/tm/doc/tm_admin.xml
Expand Up @@ -868,7 +868,7 @@ modparam("tm", "cluster_auto_cancel", no)
<title>Exported Functions</title>
<section id="func_t_relay" xreflabel="t_relay()">
<title>
<function moreinfo="none">t_relay([flags])</function>
<function moreinfo="none">t_relay([flags],[outbound_proxy])</function>
</title>
<para>
Relay a message statefully to destination indicated in current URI.
Expand All @@ -882,7 +882,10 @@ modparam("tm", "cluster_auto_cancel", no)
yet created, the function will automatically create it.
</para>
<para>
The function may take as parameter an optional set of flags for
The function may take two optional parameters.
</para>
<para>
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:
</para>
Expand Down Expand Up @@ -935,6 +938,14 @@ modparam("tm", "cluster_auto_cancel", no)

</itemizedlist>
<para>
The second parameter is a string representing an outbound proxy
(a fixed destination) where the message should be sent. The
destination is specified as <quote>[proto:]host[:port]</quote>. If a
destination URI <quote>$du</quote> for this message was set before the
function is called then this value will be used as the destination
instead of the function parameter.
</para>
<para>
In case of error, the function returns the following codes:
</para>
<itemizedlist>
Expand Down Expand Up @@ -978,36 +989,9 @@ if (!t_relay()) {
exit;
}
...
</programlisting>
</example>
</section>

<section id="func_t_relay_2" xreflabel="t_relay()">
<title>
<function moreinfo="none">t_relay(proto:host:port,[flags])</function>
</title>
<para>
Relay a message statefully to a fixed destination. The destination is
specified as <quote>[proto:]host[:port]</quote>. If a destination URI
<quote>$du</quote> for this message was set before the function
is called then this value will be used as the destination instead of the
function parameter.
</para>
<para>
The function may take as parameter an optional set of flags for
controlling the internal behaviour - for details see the above
<quote>t_relay([flags])</quote> function.
</para>
<para>
This functions can be used from REQUEST_ROUTE, FAILURE_ROUTE.
</para>
<example>
<title><function>t_relay</function> usage</title>
<programlisting format="linespecific">
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");
...
</programlisting>
</example>
Expand Down
71 changes: 4 additions & 67 deletions modules/tm/tm.c
Expand Up @@ -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}},
Expand All @@ -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}},
Expand Down Expand Up @@ -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},
Expand Down

0 comments on commit 7023ec8

Please sign in to comment.