The (ex)?page filter definition
let page = kw_word /(EX)?PAGE/
Params can have sub params
let param = [ Util.indent . param_def . [ Sep.space . param_def ]* . Util.eol ]
define a field
let param_def = let space_in = /[^ \t\n][^\n=]*[^ \t\n]|[^ \t\n]/ in key /[A-Za-z0-9_]+/ . Sep.opt_space . Sep.equal . Sep.opt_space . store space_in
A single parameter for defaults
let parameter = parameter_flag | parameter_integer | parameter_string | parameter_lists
A flag parameter for defaults
let parameter_flag_kw = "always_set_home" | "authenticate" | "env_editor" | "env_reset" | "fqdn" | "ignore_dot" | "ignore_local_sudoers" | "insults" | "log_host" | "log_year" | "long_otp_prompt" | "mail_always" | "mail_badpass" | "mail_no_host" | "mail_no_perms" | "mail_no_user" | "noexec" | "path_info" | "passprompt_override" | "preserve_groups" | "requiretty" | "root_sudo" | "rootpw" | "runaspw" | "set_home" | "set_logname" | "setenv" | "shell_noargs" | "stay_setuid" | "targetpw" | "tty_tickets" | "visiblepw" | "closefrom_override" | "closefrom_override" | "compress_io" | "fast_glob" | "log_input" | "log_output" | "pwfeedback" | "umask_override" | "use_pty" | "match_group_by_gid" | "always_query_group_plugin"
An integer parameter for defaults
let parameter_integer_nobool_kw = "passwd_tries"
A list of comma-separated parameters for defaults
let parameter_list = parameter . ( sep_com . parameter )*
A single list parameter for defaults
let parameter_lists_kw = "env_check" | "env_delete" | "env_keep"
A string parameter for defaults
let parameter_string_nobool_kw = "badpass_message" | "editor" | "mailsub" | "noexec_file" | "passprompt" | "runas_default" | "syslog_badpri" | "syslog_goodpri" | "timestampdir" | "timestampowner" | "secure_path"
Top-level parameters for the lens
let parameters = listeners | ssl_options | disk_free_limit | log_levels | Erlang.value /vm_memory_high_watermark(_paging_ratio)?/ Erlang.decimal | Erlang.value "frame_max" Erlang.integer | Erlang.value "heartbeat" Erlang.integer | Erlang.value /default_(vhost|user|pass)/ Erlang.glob | Erlang.value_list "default_user_tags" Erlang.bare | Erlang.value_list "default_permissions" Erlang.glob | cluster_nodes | Erlang.value_list "server_properties" Erlang.bare | Erlang.value "collect_statistics" Erlang.bare | Erlang.value "collect_statistics_interval" Erlang.integer | Erlang.value_list "auth_mechanisms" Erlang.quoted | Erlang.value_list "auth_backends" Erlang.bare | Erlang.value "delegate_count" Erlang.integer | Erlang.value_list "trace_vhosts" Erlang.bare | tcp_listen_options | Erlang.value "hipe_compile" Erlang.boolean | Erlang.value "msg_store_index_module" Erlang.bare | Erlang.value "backing_queue_module" Erlang.bare | Erlang.value "msg_store_file_size_limit" Erlang.integer | Erlang.value /queue_index_(max_journal_entries|embed_msgs_below)/ Erlang.integer | cluster_partition_handling | Erlang.value /(ssl_)?handshake_timeout/ Erlang.integer | Erlang.value "channel_max" Erlang.integer | Erlang.value_list "loopback_users" Erlang.glob | Erlang.value "reverse_dns_lookups" Erlang.boolean | Erlang.value "cluster_keepalive_interval" Erlang.integer | Erlang.value "mnesia_table_loading_timeout" Erlang.integer
let params = [ label "password" . store password . colon ] . admin_list? . colon . member_list?
An optional partition number for disk
let partition = [ label "partition" . Util.del_str "." . store /[0-9]+/ ]
let pass_entry = [ label "user" . [ label "username" . store Rx.word ] . Sep.space . [ label "password" . store Rx.no_spaces ] . Util.eol ]
pw_passwd
let password = [ label "password" . sto_to_col? . colon ]
pw_passwd
let password = [ label "password" . sto_to_col? . colon ]
let password = [ label "password" . (store Rx.space_in)? ]
let password_arg = [ command "password" "" . (spc . [ switch "md5" ])? . (spc . [ switch "encrypted" ])? . spc . store (/[^ \t\n]+/ - /--[^ \t\n]+/) . (spc . [ label "file" . store /[^ \t\n]+/ ])? . eol ]
let path = /[^-+#: \t\n][^#: \t\n]*/
let path = Rx.fspath
Store a path (quoted)
let path = quoted
let path = [ label "path" . store /[^# \t\n][^ \t\n]*/ . Util.eol ]
Test with a percent sign
let percent = "m /var/log/%m 2755 root systemdjournal - -\n"
Tree for percent
let percent_tree = { "1" { "type" = "m" } { "path" = "/var/log/%m" } { "mode" = "2755" } { "uid" = "root" } { "gid" = "systemdjournal" } { "age" = "-" } { "argument" = "-" } }
let period = [ label "period" . store Rx.integer ]
In the format “@keyword”
let period_name = [ label "period_name" . Util.del_str "@" . store period_name_re ]
The valid values for period_name.
let period_name_re = "monthly"
let phony_conf = "# this is a comment mykey = myvalue # eol comment anotherkey = another value "
let pin = let pin_value = pin_options | version_pin | origin_pin in Build.key_value_line "Pin" colon pin_value
A generic pin
let pin_gen (lbl:string) = store lbl . [ label lbl . Sep.space . store Rx.no_spaces ]
let pin_keys = let space_in = store /[^, \r\t\n][^,\n]*[^, \r\t\n]|[^, \t\n\r]/ in Build.key_value /[aclnov]/ Sep.equal space_in
let pin_options = let comma = Util.delim "," in store "release" . Sep.space . Build.opt_list pin_keys comma
Deletes a pipe and default to it
let pipe = Util.del_str "|"
let plus = Util.del_str "+"
Deletes a plus and default to it
let plus = Util.del_str "+"
let port = [ label "port" . store num_re ]
let port_range = [ label "start" . store num_re ] . Util.del_str "-" . [ label "end" . store num_re ]
A prefix for IP addresses
let prefixlen = [ label "prefixlen" . Util.del_str "/" . sto_num ]
let primary_entry = Build.key_value_line Rx.word Sep.equal Quote.any_opt
a program begins with an optional hash, a bang, and an optional + or -
let program = [ label "program" . opt_hash . bang . ( opt_plus | [ Build.xchgs "-" "reverse" ] ) . programs . eol . entries ]
a list of programs
let programs = label_opt_list_or "program" (store word) comma "*"
The XML prolog tag is mapped in a “#declaration” node, which contains an “#attribute” node with various attributes of the tag.
test Xml.prolog get "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" = { "#declaration" { "#attribute" { "version" = "1.0" } { "encoding" = "UTF-8" } } }
Parses property-based filters, which start with “:” and the property name
let prop_filter = let sep = Sep.comma . Util.del_opt_ws " " in let prop_name = [ Util.del_str ":" . label "property" . store Rx.word ] in let prop_oper = [ label "operation" . store /[A-Za-z!-]+/ ] in let prop_val = [ label "value" . Quote.do_dquote (store /[^\n"]*/) ] in let prop_act = [ label "action" . action ] in [ label "filter" . prop_name . sep . prop_oper . sep . prop_val . Sep.space . prop_act . Util.eol ]
let protocol = [ label "protocol" . store protocol_re ]
means UDP means TCP
let protocol = /@{1,2}/
let qpidc = "# Configuration file for the qpid c++ client library. Entries are of # the form: # name=value ssl-cert-db=/root/certs/server_db ssl-port=5674 "
let qpidd = "# Configuration file for qpidd. Entries are of the form: # name=value # (Note: no spaces on either side of '='). Using default settings: # \"qpidd --help\" or \"man qpidd\" for more details. cluster-mechanism=ANONYMOUS auth=no max-connections=22000 syslog-name=qpidd1 "
A quote, either double or single, default to double
let quote = del /["']/ "\""
An optional quote, either double or single, default to double
let quote_opt = del /["']?/ "\""
An optional quote, either double or single, default to nothing
let quote_opt_nil = del /["']?/ ""
let quote_opt_nil = let body = store Quote.any_opt_re in [ label "quote_opt_nil" . Quote.do_quote_opt_nil body ]?
Make quotes mandatory if value contains spaces, and optional if value doesn’t contain spaces.
let quote_spaces (lns:lens) =
let quoted_non_empty_string_val = del "\"" "\"" . store /[^"\n]+/ . del "\"" "\""
let quoted_string_val = del "\"" "\"" . store /[^"\n]*/ . del "\"" "\""