Home | History | Annotate | Line # | Download | only in envstat
      1  1.4  mlelstv /* 	$NetBSD: envstat.h,v 1.4 2020/11/14 09:11:55 mlelstv Exp $	*/
      2  1.1  xtraeme 
      3  1.1  xtraeme /*-
      4  1.1  xtraeme  * Copyright (c) 2007 Juan Romero Pardines.
      5  1.1  xtraeme  * All rights reserved.
      6  1.1  xtraeme  *
      7  1.1  xtraeme  * Redistribution and use in source and binary forms, with or without
      8  1.1  xtraeme  * modification, are permitted provided that the following conditions
      9  1.1  xtraeme  * are met:
     10  1.1  xtraeme  * 1. Redistributions of source code must retain the above copyright
     11  1.1  xtraeme  *    notice, this list of conditions and the following disclaimer.
     12  1.1  xtraeme  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  xtraeme  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  xtraeme  *    documentation and/or other materials provided with the distribution.
     15  1.1  xtraeme  *
     16  1.1  xtraeme  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.1  xtraeme  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  1.1  xtraeme  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  1.1  xtraeme  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  1.1  xtraeme  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21  1.1  xtraeme  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22  1.1  xtraeme  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23  1.1  xtraeme  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24  1.1  xtraeme  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25  1.1  xtraeme  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26  1.1  xtraeme  */
     27  1.1  xtraeme 
     28  1.1  xtraeme #ifndef _ENVSTAT_H_
     29  1.1  xtraeme #define _ENVSTAT_H_
     30  1.1  xtraeme 
     31  1.1  xtraeme #include <stdio.h>
     32  1.1  xtraeme #include <sys/queue.h>
     33  1.1  xtraeme #include <prop/proplib.h>
     34  1.1  xtraeme 
     35  1.1  xtraeme struct sensor_block {
     36  1.1  xtraeme 	SLIST_ENTRY(sensor_block) sb_head;
     37  1.1  xtraeme 	prop_dictionary_t dict;	/* dictionary associated */
     38  1.1  xtraeme };
     39  1.1  xtraeme 
     40  1.1  xtraeme struct device_block {
     41  1.1  xtraeme 	SLIST_ENTRY(device_block) db_head;
     42  1.1  xtraeme 	prop_array_t array;	/* array associated */
     43  1.1  xtraeme 	const char *dev_key;	/* keyword to find device array */
     44  1.1  xtraeme };
     45  1.1  xtraeme 
     46  1.1  xtraeme void config_dict_add_prop(const char *, char *);
     47  1.2  xtraeme void config_dict_adddev_prop(const char *, const char *, int);
     48  1.1  xtraeme void config_dict_destroy(prop_dictionary_t);
     49  1.1  xtraeme void config_dict_dump(prop_dictionary_t);
     50  1.4  mlelstv void config_dict_extract(prop_dictionary_t, const char *, bool);
     51  1.1  xtraeme void config_dict_fulldump(void);
     52  1.2  xtraeme void config_dict_mark(void);
     53  1.1  xtraeme prop_dictionary_t config_dict_parsed(void);
     54  1.1  xtraeme 
     55  1.1  xtraeme prop_number_t convert_val_to_pnumber(prop_dictionary_t, const char *,
     56  1.3  thorpej 				     const char *, const char *);
     57  1.1  xtraeme 
     58  1.1  xtraeme void config_devblock_add(const char *, prop_dictionary_t);
     59  1.1  xtraeme void config_devblock_check_sensorprops(prop_dictionary_t,
     60  1.1  xtraeme 				       prop_dictionary_t,
     61  1.1  xtraeme 				       const char *);
     62  1.1  xtraeme prop_dictionary_t config_devblock_getdict(const char *, const char *);
     63  1.1  xtraeme 
     64  1.1  xtraeme /*
     65  1.2  xtraeme  * The yacc function that parses the configuration file and builds
     66  1.2  xtraeme  * the dictionary for the ENVSYS_SETDICTIONARY ioctl.
     67  1.1  xtraeme  */
     68  1.1  xtraeme void config_parse(FILE *, prop_dictionary_t);
     69  1.1  xtraeme 
     70  1.1  xtraeme #endif /* _ENVSTAT_H_ */
     71