textopsStandard This module implements text based operation (search, replace, append a.s.o). Many functions support xl_lib formating using xlog module. Andrei Pelinescu-Onciul Copyright © 2003 FhG FOKUS
This is mostly an example module. It implements text based operation (search, replace, append a.s.o). Many functions support xl_lib formating using xlog module. search ignores folded lines. For example, search("(From|f):.*@foo.bar") doesn't match the following From header field: From: medabeda <sip:medameda@foo.bar>;tagi=1234 Searches for the re in the message. Meaning of the parameters is as follows:
Searches for the first match of re and appends txt after it. Meaning of the parameters is as follows:
Replaces the first occurrence of re with txt. Meaning of the parameters is as follows:
Replaces re with repl (sed or perl like). Meaning of the parameters is as follows:
Runs the re substitution on the message uri (like subst but works only on the uri) Meaning of the parameters is as follows:
Runs the re substitution on the message uri (like subst_uri but works only on the user portion of the uri) Meaning of the parameters is as follows:
Append txt to the reply. Meaning of the parameters is as follows:
Appends txt after the last header field. Meaning of the parameters is as follows:
Append header field name with original Request-URIii in middle. Meaning of the parameters is as follows:
Return true if a header field is present in message. NoteTakes header field names "as is" and doesn't distinguish compact names. Meaning of the parameters is as follows:
Append "Date" header containing the current date and time to the reply generated by SERi. Append new header value after an existing header, if no index acquired append at the end of list. Note that a header may consist of comma delimited list of values. Meaning of the parameters is as follows:
Insert new header value before an existing header, if no index acquired insert before first hf header. Note that a header may consist of comma delimited list of values. To insert value behing last value use appenf_hf_value. Meaning of the parameters is as follows:
Remove the header value from existing header, Note that a header may consist of comma delimited list of values. Meaning of the parameters is as follows:
Remove specified header or parameter. It is expected header in Authorization format (comma delimiters are not treated as multi-value delimiters). Meaning of the parameters is as follows:
Example 15. remove_hf_value2 usage ...
remove_hf_value2("foo") # remove foo[1]
remove_hf_value2("foo[*]") # remove all foo's headers, the same as remove_hf_header("foo[*]");
remove_hf_value2("foo[-1]") # last foo
remove_hf_value2("foo.bar") # delete parameter
remove_hf_value2("foo[*].bar") # for each foo delete bar parameters
...
Assign value to specified header value / param. Meaning of the parameters is as follows:
Example 16. assign_hf_value usage ...
assign_hf_value("foo", "gogo") # foo[1]
assign_hf_value("foo[-1]", "gogo") # foo[last_foo]
assign_hf_value("foo.bar", "")
assign_hf_value("foo[3].bar", "")
assign_hf_value("foo[*]", "") # remove all foo's, empty value remains
assign_hf_value("foo[*].bar", "") # set empty value (ex. lr)
...
Assign value to specified header. It is expected header in Authorization format (comma delimiters are not treated as multi-value delimiters). Meaning of the parameters is as follows:
Add value in set if not exists, eg. "Supported: path,100rel". Meaning of the parameters is as follows:
Remove value from set if exists, eg. "Supported: path,100rel". Meaning of the parameters is as follows:
Check if value exists in set. Alternate select @hf_value_exists.HF.VALUE may be used. It returns one or zero. Meaning of the parameters is as follows:
Get value of required header-value or param. Note that functions called 'value2' works with Authorization-like headers where comma is not treated as value delimiter. Formats: @hf_value.HFNAME[IDX] # idx value, negative value counts from bottom @hf_value.HFNAME.PARAM_NAME @hf_value.HFNAME[IDX].PARAM_NAME @hf_value.HFNAME.p.PARAM_NAME # or .param., useful if requred called "uri", "p", "param" @hf_value.HFNAME[IDX].p.PARAM_NAME # dtto @hf_value.HFNAME[IDX].uri # (< & > excluded) @hf_value.HFNAME[*] # return comma delimited list of all values (combines headers) @hf_value.HFNAME # the same as above [*] but may be parsed by cfg.y @hf_value.HFNAME[*].uri # return comma delimited list of uris (< & > excluded) @hf_value.HFNAME.uri # the same as above [*] but may be parsed by cfg.y @hf_value.HFNAME[IDX].name # returns name part, quotes excluded @hf_value.HFNAME.name # returns name part of the first value @hf_value2.HFNAME # returns value of first header @hf_value2.HFNAME[IDX] # returns value of idx's header @hf_value2.HFNAME.PARAM_NAME @hf_value2.HFNAME[IDX].PARAM_NAME @hf_value.HFNAME[IDX].uri # return URI, quotes excluded @hf_value.HFNAME.p.uri # returns param named uri, not URI itself @hf_value.HFNAME.p.name # returns param named name, not name itself @hf_value.HFNAME[IDX].uri.name # any sel_any_uri nested features may be used @hf_value.HFNAME[IDX].nameaddr.name # select_any_nameaddr Meaning of the parameters is as follows:
Example 21. @hf_value select usage ...
$a = @hf_value.my_header[1].my_param;
xlog("L_ERR", "%@hf_value.via[-1], %@hf_value.from.tag\n");
$b = @hf_value.p_associated_uri;
xlog("L_ERR", "Route uris: '%@hf_value.route[*].uri'\n");
$rr = @hf_value.route.uri;
$prt = @hf_value2.authorization.integrity_protected;
...
|
Navigation |
||||