A Socket Map Server
|Smap Manual (split by node):||?|
Transformations are special rules that modify the key or map value. Syntax of transformation rules is:
dispatch cond-list transform key-or-map dbname
where cond-list is a condition list, as described in the previous section, key-or-map is ‘key’ if the transformation is applied to the key value and ‘map’ if it is applied to the map name, and dbname is the name of a database that handles the transformation. For example:
dispatch key like <*> transform key dequote
This rule applies the ‘dequote’ database to any key that is enclosed in angle brackets. It is supposed that the ‘dequote’ database removes the brackets. It may be implemented using the the ‘sed’ module (see section sed module), as follows.
module sed sed database dequote sed extended 's/<(.*)>/\1/g'
The transform rules can be chained, as in the example below:
# This database removes domain part from its argument. database localpart sed 's/@.*$//' # Dispatch rules: dispatch key like <*> transform key dequote dispatch key like *@* transform key localpart dispatch default database getpwnam
As a result, the ‘getpwnam’ database will get the local part of the original key (which may be supplied in the form of an email address).
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.