1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _ZONECFG_H
#define _ZONECFG_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* header file for zonecfg command
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <unistd.h>
#define FALSE 0
#define TRUE 1
typedef int bool;
#define Z_ERR 1
#define Z_USAGE 2
#define Z_REPEAT 3
#define CMD_ADD 0
#define CMD_CANCEL 1
#define CMD_COMMIT 2
#define CMD_CREATE 3
#define CMD_DELETE 4
#define CMD_END 5
#define CMD_EXIT 6
#define CMD_EXPORT 7
#define CMD_HELP 8
#define CMD_INFO 9
#define CMD_REMOVE 10
#define CMD_REVERT 11
#define CMD_SELECT 12
#define CMD_SET 13
#define CMD_VERIFY 14
#define CMD_MIN CMD_ADD
#define CMD_MAX CMD_VERIFY
/* resource types: increment RT_MAX when expanding this list */
#define RT_UNKNOWN 0
#define RT_ZONENAME 1 /* really a property, but for info ... */
#define RT_ZONEPATH 2 /* really a property, but for info ... */
#define RT_AUTOBOOT 3 /* really a property, but for info ... */
#define RT_POOL 4 /* really a property, but for info ... */
#define RT_FS 5
#define RT_IPD 6
#define RT_NET 7
#define RT_DEVICE 8
#define RT_RCTL 9
#define RT_ATTR 10
#define RT_DATASET 11
#define RT_MIN RT_UNKNOWN
#define RT_MAX RT_DATASET
/* property types: increment PT_MAX when expanding this list */
#define PT_UNKNOWN 0
#define PT_ZONENAME 1
#define PT_ZONEPATH 2
#define PT_AUTOBOOT 3
#define PT_POOL 4
#define PT_DIR 5
#define PT_SPECIAL 6
#define PT_TYPE 7
#define PT_OPTIONS 8
#define PT_ADDRESS 9
#define PT_PHYSICAL 10
#define PT_NAME 11
#define PT_VALUE 12
#define PT_MATCH 13
#define PT_PRIV 14
#define PT_LIMIT 15
#define PT_ACTION 16
#define PT_RAW 17
#define PT_MIN PT_UNKNOWN
#define PT_MAX PT_RAW
#define MAX_EQ_PROP_PAIRS 3
#define PROP_VAL_SIMPLE 0
#define PROP_VAL_COMPLEX 1
#define PROP_VAL_LIST 2
#define PROP_VAL_MIN PROP_VAL_SIMPLE
#define PROP_VAL_MAX PROP_VAL_LIST
/*
* If any subcommand is ever modified to take more than three arguments,
* this will need to be incremented.
*/
#define MAX_SUBCMD_ARGS 3
typedef struct complex_property {
int cp_type; /* from the PT_* list above */
char *cp_value;
struct complex_property *cp_next;
} complex_property_t, *complex_property_ptr_t;
typedef struct list_property {
char *lp_simple;
complex_property_ptr_t lp_complex;
struct list_property *lp_next;
} list_property_t, *list_property_ptr_t;
typedef struct property_value {
int pv_type; /* from the PROP_VAL_* list above */
char *pv_simple;
complex_property_ptr_t pv_complex;
list_property_ptr_t pv_list;
} property_value_t, *property_value_ptr_t;
typedef struct cmd {
char *cmd_name;
void (*cmd_handler)(struct cmd *);
int cmd_res_type;
int cmd_prop_nv_pairs;
int cmd_prop_name[MAX_EQ_PROP_PAIRS];
property_value_ptr_t cmd_property_ptr[MAX_EQ_PROP_PAIRS];
int cmd_argc;
char *cmd_argv[MAX_SUBCMD_ARGS + 1];
} cmd_t;
#define HELP_USAGE 0x01
#define HELP_SUBCMDS 0x02
#define HELP_SYNTAX 0x04
#define HELP_RESOURCES 0x08
#define HELP_PROPS 0x10
#define HELP_META 0x20
#define HELP_NETADDR 0x40
#define HELP_RES_SCOPE 0x80
#define HELP_RES_PROPS (HELP_RESOURCES | HELP_PROPS)
extern void add_func(cmd_t *);
extern void cancel_func(cmd_t *);
extern void commit_func(cmd_t *);
extern void create_func(cmd_t *);
extern void delete_func(cmd_t *);
extern void end_func(cmd_t *);
extern void exit_func(cmd_t *);
extern void export_func(cmd_t *);
extern void help_func(cmd_t *);
extern void info_func(cmd_t *);
extern void remove_func(cmd_t *);
extern void revert_func(cmd_t *);
extern void select_func(cmd_t *);
extern void set_func(cmd_t *);
extern void verify_func(cmd_t *);
extern cmd_t *alloc_cmd(void);
extern complex_property_ptr_t alloc_complex(void);
extern list_property_ptr_t alloc_list(void);
extern void free_cmd(cmd_t *cmd);
extern void free_complex(complex_property_ptr_t complex);
extern void free_list(list_property_ptr_t list);
extern void free_outer_list(list_property_ptr_t list);
extern void usage(bool verbose, uint_t flags);
extern FILE *yyin;
#ifdef __cplusplus
}
#endif
#endif /* _ZONECFG_H */
|