/*- * Copyright (c) 2002 Granch Ltd. All rigts reserved. * * All or some portions of this file are derived from material licensed * to the Grahcn Ltd. and are reproduced herein with the permission of * Granch Ltd. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the author nor the names of any co-contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE GRANCH LTD. AND THEIR CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Author : Rashid N. Achilov E-Mail shelton@granch.ru * * @(#)parseconfig.h 0.91.3 (Granch Ltd.) 23/01/03 */ /*------------------------------------------------------------------------- Kaspersky Anti-Virus mail filter, based on libmilter API UNIX FreeBSD 4.6 version Descriptions to parsing configuration file -------------------------------------------------------------------------*/ #ifndef _PARSE_CONFIG_ #define _PARSE_CONFIG_ // Very common definitions #define OK 1 // Положительный возвpат #define NO 0 // Отpицательный возвpат #define ERR -1 // Возвpат с ошибкой #define NUL 0 // Нуль // Common parameters to process config files #define MAXLEN 255 // Maximum identifier length // in config file #define MAXBLOCK 1024 // Maximum work area size #define MAXDIGIT 9 // Мaximum digits in one value #define USMAX 65534 // Maximum unsigned short value #define SSMAX 32766 // Maximum signed short value #define ULMAX 4294967294 // Maximim unsigned int value #define SLMAX 2147483646 // Maximum signed int value // This is a configuration file parameters structure description. It has // next fields: parameter name (up to 32 chars, use for search parameter) // parameter processor code (one char, use for search valid parameter // processor and processing parameter value), parameter validity sing // (one char, use for check parameter validity, set by processor, check // after processing all file) and destination address. For character lines // as destination address set a pointer to pointer to allocated area, for // other types pointer to corresponding object. For bool parameter destina- // tion address will be pointed to a whole bit set. struct config_ent { char name[32]; // Parameter name u_char exit; // Parameter processor code u_char valid; // Sign of validity u_char hexmask; // When processor is STDBOOL this is a mask // to set right bit in bit set, else ignored void *which; // Destination address }; // Parameters processors #define STDCHAR 1 // Standard: character line #define STDINT 2 // Standard: integer #define STDHEX 3 // Standard: hex #define STDBOOL 4 // Standard: bool (yes/no) #define STDLONG 5 // Standard: long integer #define STDUINT 6 // Standard: unsigned integer #define STDULONG 7 // Standard: unsigned long integer #define STDUID 8 // Standard: UID #define STDGID 9 // Standard: GID #define PROGVER 254 // Mandatory: program version #define PROGNAME 255 // Mandatory: program name #define MANDFIELDS 2 // Mandatory and reserved fields #endif