xref: /titanic_50/usr/src/cmd/cmd-inet/usr.sbin/nwamcfg/nwamcfg.h (revision 6ba597c56d749c61b4f783157f63196d7b2445f0)
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 (the "License").
6  * You may not use this file except in compliance with the License.
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 
22 /*
23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _NWAMCFG_H
28 #define	_NWAMCFG_H
29 
30 /*
31  * header file for nwamcfg command
32  */
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #define	NWAM_OK			0
39 #define	NWAM_ERR		1
40 #define	NWAM_REPEAT		2
41 
42 /* max length of "ncu", "ncp", "loc", "enm", "wlan" */
43 #define	NWAM_MAX_TYPE_LEN	5
44 
45 #define	CMD_CANCEL		0
46 #define	CMD_CLEAR		1
47 #define	CMD_COMMIT		2
48 #define	CMD_CREATE		3
49 #define	CMD_DESTROY		4
50 #define	CMD_END			5
51 #define	CMD_EXIT		6
52 #define	CMD_EXPORT		7
53 #define	CMD_GET			8
54 #define	CMD_HELP		9
55 #define	CMD_LIST		10
56 #define	CMD_REVERT		11
57 #define	CMD_SELECT		12
58 #define	CMD_SET			13
59 #define	CMD_VERIFY		14
60 #define	CMD_WALKPROP		15
61 
62 #define	CMD_MIN	CMD_CANCEL
63 #define	CMD_MAX	CMD_WALKPROP
64 
65 /* one-level resource types */
66 #define	RT1_UNKNOWN		0
67 #define	RT1_LOC			1
68 #define	RT1_NCP			2
69 #define	RT1_ENM			3
70 #define	RT1_WLAN		4
71 
72 #define	RT1_MIN			RT1_UNKNOWN
73 #define	RT1_MAX			RT1_WLAN
74 
75 /* two-level resource types */
76 #define	RT2_UNKNOWN		0
77 #define	RT2_NCU			1
78 
79 #define	RT2_MIN			RT2_UNKNOWN
80 #define	RT2_MAX			RT2_NCU
81 
82 /* class types for NCU's */
83 #define	NCU_CLASS_PHYS		0
84 #define	NCU_CLASS_IP		1
85 #define	NCU_CLASS_ANY		2
86 
87 #define	NCU_CLASS_MIN		NCU_CLASS_PHYS
88 #define	NCU_CLASS_MAX		NCU_CLASS_ANY
89 
90 /* property types, matches NWAM_*_PROP_* from libnwam.h */
91 #define	PT_UNKNOWN		0
92 #define	PT_ACTIVATION_MODE	1
93 #define	PT_ENABLED		2
94 #define	PT_TYPE			3
95 #define	PT_CLASS		4
96 #define	PT_PARENT		5
97 #define	PT_PRIORITY_GROUP	6
98 #define	PT_PRIORITY_MODE	7
99 #define	PT_LINK_MACADDR		8
100 #define	PT_LINK_AUTOPUSH	9
101 #define	PT_LINK_MTU		10
102 #define	PT_IP_VERSION		11
103 #define	PT_IPV4_ADDRSRC		12
104 #define	PT_IPV4_ADDR		13
105 #define	PT_IPV4_DEFAULT_ROUTE	14
106 #define	PT_IPV6_ADDRSRC		15
107 #define	PT_IPV6_ADDR		16
108 #define	PT_IPV6_DEFAULT_ROUTE	17
109 #define	PT_CONDITIONS		18
110 #define	PT_ENM_FMRI		19
111 #define	PT_ENM_START		20
112 #define	PT_ENM_STOP		21
113 #define	PT_LOC_NAMESERVICES	22
114 #define	PT_LOC_NAMESERVICES_CONFIG 23
115 #define	PT_LOC_DNS_CONFIGSRC	24
116 #define	PT_LOC_DNS_DOMAIN	25
117 #define	PT_LOC_DNS_SERVERS	26
118 #define	PT_LOC_DNS_SEARCH	27
119 #define	PT_LOC_NIS_CONFIGSRC	28
120 #define	PT_LOC_NIS_SERVERS	29
121 #define	PT_LOC_LDAP_CONFIGSRC	30
122 #define	PT_LOC_LDAP_SERVERS	31
123 #define	PT_LOC_DEFAULT_DOMAIN	32
124 #define	PT_LOC_NFSV4_DOMAIN	33
125 #define	PT_LOC_IPF_CONFIG	34
126 #define	PT_LOC_IPF_V6_CONFIG	35
127 #define	PT_LOC_IPNAT_CONFIG	36
128 #define	PT_LOC_IPPOOL_CONFIG	37
129 #define	PT_LOC_IKE_CONFIG	38
130 #define	PT_LOC_IPSECPOL_CONFIG	39
131 #define	PT_WLAN_BSSIDS		40
132 #define	PT_WLAN_PRIORITY	41
133 #define	PT_WLAN_KEYNAME		42
134 #define	PT_WLAN_KEYSLOT		43
135 #define	PT_WLAN_SECURITY_MODE	44
136 /*
137  * If any new PT_ are defined here, make sure it is added in the same
138  * order into the pt_types array in nwamcfg.c
139  */
140 #define	PT_MIN			PT_UNKNOWN
141 #define	PT_MAX			PT_WLAN_SECURITY_MODE
142 
143 #define	MAX_SUBCMD_ARGS	3
144 
145 typedef struct cmd {
146 	int	cmd_num;
147 	void	(*cmd_handler)(struct cmd *);
148 	int	cmd_res1_type;
149 	int	cmd_res2_type;
150 	int	cmd_prop_type;
151 	int	cmd_ncu_class_type;
152 	int	cmd_argc;
153 	char	*cmd_argv[MAX_SUBCMD_ARGS + 1];
154 } cmd_t;
155 
156 /* Fuctions for each command */
157 typedef void (cmd_func_t)(cmd_t *);
158 
159 extern cmd_func_t cancel_func, clear_func, commit_func, create_func;
160 extern cmd_func_t destroy_func, end_func, exit_func, export_func, get_func;
161 extern cmd_func_t help_func, list_func, revert_func, select_func, set_func;
162 extern cmd_func_t verify_func, walkprop_func;
163 
164 extern cmd_t *alloc_cmd(void);
165 extern void free_cmd(cmd_t *cmd);
166 
167 extern boolean_t check_scope(int);
168 extern const char *cmd_to_str(int);
169 
170 extern void nerr(const char *, ...);
171 extern void properr(const char *);
172 
173 extern boolean_t saw_error;
174 
175 extern FILE *yyin;
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif	/* _NWAMCFG_H */
182