aconf.h (7c478bd95313f5f23a4c958a745db2134aa03244) aconf.h (074e084f68dd0b08686612bec695a0cfe249da6d)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
23 * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved.
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#ifndef _ACONF_H
28#define _ACONF_H
29
30#pragma ident "%Z%%M% %I% %E% SMI"
31
32#include <sys/types.h>
33#include <sys/param.h>
34#include <stdio.h>
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
23 * Use is subject to license terms.
24 */
25
26#ifndef _ACONF_H
27#define _ACONF_H
28
29#pragma ident "%Z%%M% %I% %E% SMI"
30
31#include <sys/types.h>
32#include <sys/param.h>
33#include <stdio.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
40/*
41 * Permissions and ownership for the configuration file:
42 */
43#define AC_OWNER 0 /* Uid 0 (root) */
44#define AC_GROUP 1 /* Gid 1 (other) */
45#define AC_PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) /* Mode 0644 */
46
47#define MAXRESLEN 256
48
49typedef struct acctconf {
39#define MAXRESLEN 256
40
41typedef struct acctconf {
50 FILE *ac_conf_fp; /* file pointer for config file */
51 int ac_conf_fd; /* file descriptor for config file */
52 int ac_proc_state;
53 char ac_proc_file[MAXPATHLEN];
54 char ac_proc_tracked[MAXRESLEN];
55 char ac_proc_untracked[MAXRESLEN];
56 char ac_task_file[MAXPATHLEN];
57 char ac_task_tracked[MAXRESLEN];
58 char ac_task_untracked[MAXRESLEN];
59 int ac_task_state;
60 char ac_flow_file[MAXPATHLEN];
61 char ac_flow_tracked[MAXRESLEN];
62 char ac_flow_untracked[MAXRESLEN];
63 int ac_flow_state;
42 int state;
43 char file[MAXPATHLEN];
44 char tracked[MAXRESLEN];
45 char untracked[MAXRESLEN];
64} acctconf_t;
65
66/*
67 * Predefined strings
68 */
46} acctconf_t;
47
48/*
49 * Predefined strings
50 */
69#define AC_STR_YES "yes"
70#define AC_STR_NO "no"
71#define AC_STR_NONE "none"
51#define AC_STR_NONE "none"
72
52
73extern void aconf_init(acctconf_t *);
74extern int aconf_create(acctconf_t *, const char *);
75extern int aconf_open(acctconf_t *, const char *);
76extern int aconf_close(acctconf_t *);
77extern int aconf_setup(acctconf_t *);
78extern int aconf_write(acctconf_t *);
79extern int aconf_update(acctconf_t *);
80extern void aconf_print(acctconf_t *, FILE *, int);
53/*
54 * Configuration property group name
55 */
56#define AC_PGNAME "config"
81
57
82extern int aconf_str2enable(acctconf_t *, char *, int);
83extern int aconf_str2file(acctconf_t *, char *, int);
84extern int aconf_str2tracked(acctconf_t *, char *, int);
85extern int aconf_str2untracked(acctconf_t *, char *, int);
58/*
59 * Configuration property names
60 */
61#define AC_PROP_STATE "enabled"
62#define AC_PROP_FILE "file"
63#define AC_PROP_TRACKED "tracked"
64#define AC_PROP_UNTRACKED "untracked"
86
65
66extern void aconf_init(acctconf_t *, int);
67extern int aconf_setup(const char *);
68extern int aconf_scf_init(const char *);
69extern void aconf_scf_fini(void);
70extern int aconf_set_string(const char *, const char *);
71extern int aconf_set_bool(const char *, boolean_t);
72extern int aconf_save(void);
73extern void aconf_print(FILE *, int);
74extern boolean_t aconf_have_smf_auths(void);
75extern const char *aconf_type2fmri(int);
76
87#ifdef __cplusplus
88}
89#endif
90
91#endif /* _ACONF_H */
77#ifdef __cplusplus
78}
79#endif
80
81#endif /* _ACONF_H */