From c4315a4755c555ac9a5c65649625e7678c470ca8 Mon Sep 17 00:00:00 2001 From: Kamailio Dev Date: Wed, 31 May 2017 09:31:47 +0200 Subject: [PATCH] modules: readme files regenerated - ratelimit ... [skip ci] --- src/modules/ratelimit/README | 43 ++++++++++-------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/src/modules/ratelimit/README b/src/modules/ratelimit/README index 78648295eab..3982bd554ad 100644 --- a/src/modules/ratelimit/README +++ b/src/modules/ratelimit/README @@ -51,7 +51,7 @@ Hendrik Scholz 6. Functions 6.1. rl_check([pvar]) - 6.2. rl_check_pipe([pipe_no]) + 6.2. rl_check_pipe(pipe_no) 7. RPC Commands @@ -103,7 +103,7 @@ Chapter 1. Admin Guide 6. Functions 6.1. rl_check([pvar]) - 6.2. rl_check_pipe([pipe_no]) + 6.2. rl_check_pipe(pipe_no) 7. RPC Commands @@ -325,7 +325,7 @@ modparam("ratelimit", "pipe", "4:NETWORK:10000") 6. Functions 6.1. rl_check([pvar]) - 6.2. rl_check_pipe([pipe_no]) + 6.2. rl_check_pipe(pipe_no) 6.1. rl_check([pvar]) @@ -334,8 +334,7 @@ modparam("ratelimit", "pipe", "4:NETWORK:10000") type, and then the pipe will be identified based on the matched queue. If a pipe number is provided as a parameter, then the given pipe number will be used for identifying the ratelimit algorithm. The pipe number - must be provided via a pseudovariable. It is recommended to provide the - pipe number via an integer pseudovariable. + must be provided as number or via a pseudovariable. The method will return an error code if the limit for the matched algorithm is reached. @@ -344,7 +343,7 @@ modparam("ratelimit", "pipe", "4:NETWORK:10000") * pvar - the pseudovariable holding the pipe id to be used by ratelimit. - This function can be used from REQUEST_ROUTE. + This function can be used from ANY_ROUTE. Example 1.4. rl_check usage ... @@ -353,7 +352,7 @@ modparam("ratelimit", "pipe", "4:NETWORK:10000") append_to_reply("Retry-After: 5\r\n"); sl_send_reply("503","Limiting"); exit; - }; + } ... # use pipe no 1 for the current method # set int pvar to 1 @@ -362,25 +361,14 @@ modparam("ratelimit", "pipe", "4:NETWORK:10000") append_to_reply("Retry-After: 5\r\n"); sl_send_reply("503","Limiting"); exit; - }; -... - # use pipe no 1 for the current method - # set str pvar to 1 - $var(p) = "1"; - if (!rl_check("$var(p)") { - append_to_reply("Retry-After: 5\r\n"); - sl_send_reply("503","Limiting"); - exit; - }; + } ... -6.2. rl_check_pipe([pipe_no]) +6.2. rl_check_pipe(pipe_no) - Check the current request against the matched ratelimit algorithm. If - no parameter is provided, the queue will be matched based on method - type, and then the pipe will be identified based on the matched queue. - If a pipe number is provided as a parameter, then the given pipe number - will be used for identifying the ratelimit algorithm. + Check the current request against the matched ratelimit algorithm of + the pipe provided as parameter. The parameter can be provided as number + or variable. The method will return an error code if the limit for the matched algorithm is reached. @@ -391,20 +379,13 @@ modparam("ratelimit", "pipe", "4:NETWORK:10000") This function can be used from REQUEST_ROUTE. Example 1.5. rl_check_pipe usage -... - # perform queue/pipe match for current method - if (!rl_check_pipe()) { - append_to_reply("Retry-After: 5\r\n"); - sl_send_reply("503","Limiting"); - exit; - }; ... # use pipe no 1 for the current method if (!rl_check_pipe("1") { append_to_reply("Retry-After: 5\r\n"); sl_send_reply("503","Limiting"); exit; - }; + } ... 7. RPC Commands