#-----------------------------------------------------------------------------
# /etc/check.d/base.exp - expressions for check table of configuration params
#
# Creation:     14.09.2003  fm
# Last Update:  $Id$
#
# Copyright (c) 2003-2004 Frank Meyer <frank@eisfair.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#-----------------------------------------------------------------------------
NONE            = '.*'                  : ''
NOTEMPTY        = '.*[^ ]+.*'           : 'may not be empty'
NOBLANK         = '[^ ]+'               : 'may not contain spaces'
ENOBLANK        = '()|(RE:NOBLANK)'
		: 'neither without spaces nor empty'
NUMERIC         = '[0-9]+'              : 'should be numeric (decimal)'
ENUMERIC        = '()|(RE:NUMERIC)'
		: 'neither numeric nor empty'
DOT_NUMERIC     = '(RE:NUMERIC).(RE:NUMERIC)'
		: 'should be numeric (decimal) with dot e.g. 5.0'
EDOT_NUMERIC    = '()|(RE:NUMERIC).(RE:NUMERIC)'
		: 'neither numeric (decimal) with dot e.g. 5.0 nor empty'
NUM_HEX         = '0x[[:xdigit:]]+'
		: 'should be a hexadecimal number
		   (a number starting with "0x")'
NUM_ANY         = '(RE:NUMERIC)|(RE:NUM_HEX)'
		: 'should be a decimal or hexadecimal number'
YESNO           = 'yes|no'              : 'only yes or no are allowed'
MACADDR         = '[[:xdigit:]][[:xdigit:]](:[[:xdigit:]][[:xdigit:]]){5}'
		: 'wrong mac address, should be 6 hex numbers each
		   represented by two digits
		   and devided by ":" (for instance 00:00:E8:83:72:92)'
HOSTNAME        = '[[:alnum:]](-?[[:alnum:]])*'
		: 'wrong hostname, only letters, numbers and minus sign
		   are allowed;
		   no leading or trailing minus sign'
EHOSTNAME       = '()|(RE:HOSTNAME)'
                : 'no valid hostname, should be empty or contain only
                   letters, numbers and minus sign are allowed; no
                   leading or trailing minus sign.'
DOMAIN          = '[[:alnum:]](-?[[:alnum:]])*(\.[[:alnum:]](-?[[:alnum:]])*)*'
		: 'wrong domain name, only letters, numbers and minus sign
		   are allowed; parts are divided by a dot (for instance
		   lan.fli4l); no leading or trailing minus sign or dot'
EDOMAIN         = '()|(RE:DOMAIN)'
		: 'neither valid domain name (only letters, numbers and minus
		   sign are allowed; parts are divided by a dot (for instance
		   lan.fli4l); no leading or trailing minus sign or dot) nor empty'
FQDN            = '(RE:HOSTNAME)\.(RE:DOMAIN)'
		: 'wrong fully qualified domain name, should consist of a
		   host name and a domain name diveded by a dot; only
		   letters, numbers and minus sign are allowed, no leading
		   or trailing minus sign'
EFQDN           = '()|(RE:FQDN)'
		: 'neither a fully qualified domain name (should consist of a
		   host name and a domain name diveded by a dot; only letters,
		   numbers and minus sign are allowed, no leading or trailing
		   minus sign) nor empty'
OCTET           = '1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]'
		: 'should be a value between 0 and 255'
IPADDR          = '((RE:OCTET)\.){3}(RE:OCTET)' : 'no valid ip address'
IPADDRESSES     = '(RE:IPADDR)([[:space:]]+(RE:IPADDR))*'
		: 'no valid ip address, please specify one or more valid
		   ip addresses'
EIPADDR         = '()|(RE:IPADDR)'
		: 'neither valid ip address nor empty'
EIPADDRESSES    = '()|(RE:IPADDRESSES)'
		: 'should be empty or contain one or more valid
		   ip addresses'
DNS_SPEC        = '(RE:DOMAIN)[[:space:]]+(RE:IPADDR)'
		: 'invalid specification for special dns servers, should
		   be a domain name followed by one ip address'
MASK            = '3[0-2]|[1-2]?[0-9]'
		: 'no valid netmask spezified, please specify a value
		   between 0 and 32'
NETWORK         = '(RE:IPADDR)/(RE:MASK)'
		: 'no valid network specification, should be a network
		  address followed by a netmask, for instance 192.168.6.0/24'
NETWORKS        = '(RE:NETWORK)([[:space:]]+(RE:NETWORK))*'
		: 'no valid network specification, should be one or more
		  network addresse(s) followed by a netmask,
		  for instance 192.168.6.0/24'
ENETWORKS       = '()|(RE:NETWORKS)'
		: 'no valid network specification, should be empty or
		  should contain one or more
		  network addresse(s) followed by a netmask,
		  for instance 192.168.6.0/24'
MULTIPLE_NETWORKS       = '(RE:NETWORK)([[:space:]]+(RE:NETWORK))+'
		: 'no valid network specification, should be two or more
		  network addresses followed by their netmasks,
		  for instance "192.168.6.0/24 192.168.7.0/24"'
EMULTIPLE_NETWORKS      = '()|(RE:MULTIPLE_NETWORKS)'
		: 'no valid network specification, should be empty or
		  contain two or more
		  network addresses followed by their netmasks,
		  for instance "192.168.6.0/24 192.168.7.0/24"'
IPADDR_NETWORK  = '(RE:IPADDR)|(RE:NETWORK)'
		: 'neither valid ip address nor valid network'
EIPADDR_NETWORK = '()|(RE:IPADDR)|(RE:NETWORK)'
		: 'no valid ip address, network or empty'
MAILADDR        = '[[:alnum:]]([[:alnum:]._-]+)?@((RE:DOMAIN)|localhost)'
		: 'not a valid mail address, use e.g. "aaaa@bbbb.ccc"'
EMAILADDR       = '()|(RE:MAILADDR)'
		: 'neither a mail address nor empty'
CRONTAB         = '([0-9,/*-]+) *([0-9,/*-]+) *([0-9,/*-]+) *([0-9,/*(jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec)-]+) *([0-7,/*(mon,tue,wed,thu,fri,sat,sun)-]+)'
		: 'not a valid crontab string, use e.g. "3 5 * * *"'
DISK            = '(sd[a-p]|hd[a-l])'
                : 'no valid disk'
PARTITION       = '(RE:DISK)[1-8]'
                : 'no valid partion'
REL_PATH        = '(([[:alnum:]]|[-_.])+)(/([[:alnum:]]|[-_.])+)*/?'
		: 'no valid relative path, only numbers, letters, "-" and
		   "_" divided by "/" are allowed'
E_REL_PATH      = '()|(RE:REL_PATH)'
		: 'neither empty nor valid relative path; only numbers,
		  letters, "-" and "_" divided by "/" are allowed'
ABS_PATH        = '/(RE:REL_PATH)?'
		: 'no valid absolute path (must start with a slash and
		   only numbers, letters, "-" and "_" divided by "/" are
		   allowed)'
E_ABS_PATH      = '()|(RE:ABS_PATH)'
		: 'neither empty nor
		   valid absolute path (must start with a slash and
		   only numbers, letters, "-" and "_" divided by "/" are
		   allowed)'
LOG_INTERVAL    = 'daily|weekly|monthly'
                : 'no valid interval, should be daily, weekly or monthly'
PORT            = '[0-9]{0,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]'
                : 'port must be in range 1..65535'                
ETH_BASE_DEV_NAME = 'eth[1-9]?[0-9]'
                  : 'Invalid ethernet device name, ether devices are named eth0, eth1, ..., eth9'
ETH_DEV_NAME    = '(RE:ETH_BASE_DEV_NAME)(:[1-9]?[0-9])?'
                : 'Invalid ethernet device name, ether devices are named eth0, eth1:3, eth2:0'
TR_DEV_NAME     = 'tr[1-9]?[0-9]'
                : 'Invalid tokenring device name, tokenring devices are named tr0, tr1, ..., tr9'
BR_BASE_DEV_NAME = 'br[1-9]?[0-9]'
                 : 'Invalid bridge device name, bridge devices are named br0, br1, ..., br9'
BR_DEV_NAME     = '(RE:BR_BASE_DEV_NAME)(:[1-9]?[0-9])?'
                : 'Invalid bridge device name, bridge devices are named br0, br1:3, br2:0'
DUMMY_DEV_NAME  = 'dummy[0-9]+'
                : 'Invalid dummy device name, dummy devices are named dummy<number>'
IP_NET_NAME     = '(RE:TR_DEV_NAME)|(RE:BR_DEV_NAME)|(RE:ETH_DEV_NAME)|(RE:DUMMY_DEV_NAME)'
                : 'Invalid device name, only ethernet (eth), token ring (tr), bridge (br) or dummy (dummy<number>) devices are allowed.'
IP_ROUTE        = '(RE:IPADDR)[[:space:]]+(RE:IPADDR)[[:space:]]+(RE:IPADDR)'
		: 'no valid route specification (network netmask gateway)'
IP_ROUTE_CIDR   = '(RE:NETWORK)[[:space:]]+(((RE:IPADDR)|(RE:IP_NET_NAME))|((RE:IPADDR)[[:space:]]+(RE:IP_NET_NAME)))'
                : 'no valid route specification (network/cidr gateway)'