Annotation of embedaddon/istgt/src/istgt_conf.h, revision 1.1.1.2

1.1       misho       1: /*
1.1.1.2 ! misho       2:  * Copyright (C) 2008-2012 Daisuke Aoyama <aoyama@peach.ne.jp>.
1.1       misho       3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms, with or without
                      6:  * modification, are permitted provided that the following conditions
                      7:  * are met:
                      8:  * 1. Redistributions of source code must retain the above copyright
                      9:  *    notice, this list of conditions and the following disclaimer.
                     10:  * 2. Redistributions in binary form must reproduce the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer in the
                     12:  *    documentation and/or other materials provided with the distribution.
                     13:  *
                     14:  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
                     15:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     16:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     17:  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
                     18:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     19:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     20:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     21:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     22:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     23:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     24:  * SUCH DAMAGE.
                     25:  *
                     26:  */
                     27: 
                     28: #ifndef ISTGT_CONF_H
                     29: #define ISTGT_CONF_H
                     30: 
                     31: typedef struct config_value_t {
                     32:        struct config_value_t *next;
                     33:        char *value;
                     34: } CF_VALUE;
                     35: 
                     36: typedef struct config_item_t {
                     37:        struct config_item_t *next;
                     38:        char *key;
                     39:        CF_VALUE *val;
                     40: } CF_ITEM;
                     41: 
                     42: typedef enum
                     43: {
                     44:        ST_INVALID = -1,
                     45:        ST_NONE = 0,
                     46:        ST_GLOBAL,
                     47:        ST_UNITCONTROL,
                     48:        ST_PORTALGROUP,
                     49:        ST_INITIATORGROUP,
                     50:        ST_LOGICAL_UNIT,
                     51:        ST_AUTHGROUP,
                     52: } CF_SECTION_TYPE;
                     53: 
                     54: typedef struct config_section_t
                     55: {
                     56:        struct config_section_t *next;
                     57:        CF_SECTION_TYPE type;
                     58:        char *name;
                     59:        int num;
                     60:        CF_ITEM *item;
                     61: } CF_SECTION;
                     62: 
                     63: typedef struct config_t
                     64: {
                     65:        char *file;
                     66:        CF_SECTION *current_section;
                     67:        CF_SECTION *section;
                     68: } CONFIG;
                     69: 
                     70: CONFIG *istgt_allocate_config(void);
                     71: void istgt_free_config(CONFIG *cp);
1.1.1.2 ! misho      72: void istgt_copy_cf_item(CF_SECTION *sp_dst, CF_SECTION *sp_src);
1.1       misho      73: CF_SECTION *istgt_find_cf_section(CONFIG *cp, const char *name);
                     74: CF_ITEM *istgt_find_cf_nitem(CF_SECTION *sp, const char *key, int idx);
                     75: CF_ITEM *istgt_find_cf_item(CF_SECTION *sp, const char *key);
                     76: int istgt_read_config(CONFIG *cp, const char *file);
                     77: int istgt_print_config(CONFIG *cp);
                     78: 
                     79: #endif /* ISTGT_CONF_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>