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