%{
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include "nwamcfg.h"
/* yacc externals */
extern int yydebug;
extern void yyerror(char *s);
extern boolean_t newline_terminated;
%}
%union {
int ival;
char *strval;
}
%%
{
if ($1 != NULL) {
free_cmd($1);
}
return (0);
}
{
if ($1 != NULL)
free_cmd($1);
if (YYRECOVERING())
}
{
if (YYRECOVERING())
}
{
return (0);
}
{
cmd = $$;
$$->cmd_num = CMD_CANCEL;
$$->cmd_handler = &cancel_func;
$$->cmd_argc = 0;
}
{
}
{
properr($2);
}
{
/* clear prop */
cmd = $$;
$$->cmd_handler = &clear_func;
$$->cmd_prop_type = $2;
$$->cmd_argc = 0;
}
{
cmd = $$;
$$->cmd_num = CMD_COMMIT;
$$->cmd_handler = &commit_func;
$$->cmd_argc = 0;
}
{
}
{
}
{
}
{
}
{
cmd = $$;
$$->cmd_num = CMD_CREATE;
$$->cmd_handler = &create_func;
$$->cmd_res1_type = $2;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $3;
}
{
cmd = $$;
$$->cmd_num = CMD_CREATE;
$$->cmd_handler = &create_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $2;
$$->cmd_ncu_class_type = $3;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $4;
}
{
cmd = $$;
$$->cmd_num = CMD_CREATE;
$$->cmd_handler = &create_func;
$$->cmd_res1_type = $4;
$$->cmd_argc = 3;
$$->cmd_argv[0] = $2;
}
{
cmd = $$;
$$->cmd_num = CMD_CREATE;
$$->cmd_handler = &create_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $4;
$$->cmd_ncu_class_type = $5;
$$->cmd_argc = 3;
$$->cmd_argv[0] = $2;
}
{
}
{
/* destroy -a */
cmd = $$;
$$->cmd_num = CMD_DESTROY;
$$->cmd_handler = &destroy_func;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $2;
}
{
}
{
}
{
cmd = $$;
$$->cmd_num = CMD_DESTROY;
$$->cmd_handler = &destroy_func;
$$->cmd_res1_type = $2;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $3;
}
{
/* destroy ncu test (class inferred) */
cmd = $$;
$$->cmd_num = CMD_DESTROY;
$$->cmd_handler = &destroy_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $2;
$$->cmd_ncu_class_type = NCU_CLASS_ANY;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $3;
}
{
cmd = $$;
$$->cmd_num = CMD_DESTROY;
$$->cmd_handler = &destroy_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $2;
$$->cmd_ncu_class_type = $3;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $4;
}
{
cmd = $$;
$$->cmd_handler = &end_func;
$$->cmd_argc = 0;
}
{
cmd = $$;
$$->cmd_handler = &exit_func;
$$->cmd_argc = 0;
}
{
cmd = $$;
$$->cmd_num = CMD_EXPORT;
$$->cmd_handler = &export_func;
$$->cmd_argc = 0;
}
{
}
{
/* export -d */
cmd = $$;
$$->cmd_num = CMD_EXPORT;
$$->cmd_handler = &export_func;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $2;
}
{
/* export -f file */
cmd = $$;
$$->cmd_num = CMD_EXPORT;
$$->cmd_handler = &export_func;
$$->cmd_argc = 2;
$$->cmd_argv[0] = $2;
}
{
/* export -d -f file */
cmd = $$;
$$->cmd_num = CMD_EXPORT;
$$->cmd_handler = &export_func;
$$->cmd_argc = 3;
$$->cmd_argv[0] = $2;
}
{
cmd = $$;
$$->cmd_num = CMD_EXPORT;
$$->cmd_handler = &export_func;
$$->cmd_res1_type = $2;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $3;
}
{
/* export ncu test (all ncu's named test) */
cmd = $$;
$$->cmd_num = CMD_EXPORT;
$$->cmd_handler = &export_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $2;
$$->cmd_ncu_class_type = NCU_CLASS_ANY;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $3;
}
{
cmd = $$;
$$->cmd_num = CMD_EXPORT;
$$->cmd_handler = &export_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $2;
$$->cmd_ncu_class_type = $3;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $4;
}
{
cmd = $$;
$$->cmd_num = CMD_EXPORT;
$$->cmd_handler = &export_func;
$$->cmd_res1_type = $4;
$$->cmd_argc = 3;
$$->cmd_argv[0] = $2;
}
{
/* export -f file ncu test (all ncu's named test) */
cmd = $$;
$$->cmd_num = CMD_EXPORT;
$$->cmd_handler = &export_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $4;
$$->cmd_ncu_class_type = NCU_CLASS_ANY;
$$->cmd_argc = 3;
$$->cmd_argv[0] = $2;
}
{
cmd = $$;
$$->cmd_num = CMD_EXPORT;
$$->cmd_handler = &export_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $4;
$$->cmd_ncu_class_type = $5;
$$->cmd_argc = 3;
$$->cmd_argv[0] = $2;
}
{
}
{
properr($2);
}
{
/* get prop */
cmd = $$;
$$->cmd_handler = &get_func;
$$->cmd_prop_type = $2;
$$->cmd_argc = 0;
}
{
/* get -V prop */
cmd = $$;
$$->cmd_handler = &get_func;
$$->cmd_prop_type = $3;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $2;
}
{
cmd = $$;
$$->cmd_handler = &help_func;
$$->cmd_argc = 0;
}
{
/* help command */
cmd = $$;
$$->cmd_handler = &help_func;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $2;
}
{
cmd = $$;
$$->cmd_handler = &list_func;
$$->cmd_argc = 0;
}
{
}
{
/* list -a */
cmd = $$;
$$->cmd_handler = &list_func;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $2;
}
{
}
{
}
{
cmd = $$;
$$->cmd_handler = &list_func;
$$->cmd_res1_type = $2;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $3;
}
{
/* list ncu test (all ncu's named test) */
cmd = $$;
$$->cmd_handler = &list_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $2;
$$->cmd_ncu_class_type = NCU_CLASS_ANY;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $3;
}
{
cmd = $$;
$$->cmd_handler = &list_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $2;
$$->cmd_ncu_class_type = $3;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $4;
}
{
cmd = $$;
$$->cmd_handler = &list_func;
$$->cmd_res1_type = $3;
$$->cmd_argc = 2;
$$->cmd_argv[0] = $4;
}
{
/* list -a ncu test (all ncu's named test) */
cmd = $$;
$$->cmd_handler = &list_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $3;
$$->cmd_ncu_class_type = NCU_CLASS_ANY;
$$->cmd_argc = 2;
$$->cmd_argv[0] = $4;
}
{
cmd = $$;
$$->cmd_handler = &list_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $3;
$$->cmd_ncu_class_type = $4;
$$->cmd_argc = 2;
$$->cmd_argv[0] = $5;
}
{
cmd = $$;
$$->cmd_num = CMD_REVERT;
$$->cmd_handler = &revert_func;
$$->cmd_argc = 0;
}
{
}
{
}
{
}
{
}
{
cmd = $$;
$$->cmd_num = CMD_SELECT;
$$->cmd_handler = &select_func;
$$->cmd_res1_type = $2;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $3;
}
{
/* select ncu test (class inferred) */
cmd = $$;
$$->cmd_num = CMD_SELECT;
$$->cmd_handler = &select_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $2;
$$->cmd_ncu_class_type = NCU_CLASS_ANY;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $3;
}
{
cmd = $$;
$$->cmd_num = CMD_SELECT;
$$->cmd_handler = &select_func;
$$->cmd_res1_type = RT1_NCP;
$$->cmd_res2_type = $2;
$$->cmd_ncu_class_type = $3;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $4;
}
{
}
{
properr($2);
}
{
/* set prop=value */
cmd = $$;
$$->cmd_handler = &set_func;
$$->cmd_prop_type = $2;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $4;
}
{
cmd = $$;
$$->cmd_num = CMD_VERIFY;
$$->cmd_handler = &verify_func;
$$->cmd_argc = 0;
}
{
cmd = $$;
$$->cmd_num = CMD_WALKPROP;
$$->cmd_handler = &walkprop_func;
$$->cmd_argc = 0;
}
{
/* walkprop -a */
cmd = $$;
$$->cmd_num = CMD_WALKPROP;
$$->cmd_handler = &walkprop_func;
$$->cmd_argc = 1;
$$->cmd_argv[0] = $2;
}
| IP { $$ = NCU_CLASS_IP; }
| ACTIVATION_MODE { $$ = PT_ACTIVATION_MODE; }
| CONDITIONS { $$ = PT_CONDITIONS; }
| ENABLED { $$ = PT_ENABLED; }
| PRIORITY_GROUP { $$ = PT_PRIORITY_GROUP; }
| PRIORITY_MODE { $$ = PT_PRIORITY_MODE; }
| LINK_MACADDR { $$ = PT_LINK_MACADDR; }
| LINK_AUTOPUSH { $$ = PT_LINK_AUTOPUSH; }
| LINK_MTU { $$ = PT_LINK_MTU; }
| IP_VERSION { $$ = PT_IP_VERSION; }
| IPV4_ADDRSRC { $$ = PT_IPV4_ADDRSRC; }
| IPV4_ADDR { $$ = PT_IPV4_ADDR; }
| IPV4_DEFAULT_ROUTE { $$ = PT_IPV4_DEFAULT_ROUTE; }
| IPV6_ADDRSRC { $$ = PT_IPV6_ADDRSRC; }
| IPV6_ADDR { $$ = PT_IPV6_ADDR; }
| IPV6_DEFAULT_ROUTE { $$ = PT_IPV6_DEFAULT_ROUTE; }
| ENM_FMRI { $$ = PT_ENM_FMRI; }
| ENM_START { $$ = PT_ENM_START; }
| ENM_STOP { $$ = PT_ENM_STOP; }
| LOC_NAMESERVICES { $$ = PT_LOC_NAMESERVICES; }
| LOC_NAMESERVICES_CONFIG { $$ = PT_LOC_NAMESERVICES_CONFIG; }
| LOC_DNS_CONFIGSRC { $$ = PT_LOC_DNS_CONFIGSRC; }
| LOC_DNS_DOMAIN { $$ = PT_LOC_DNS_DOMAIN; }
| LOC_DNS_SERVERS { $$ = PT_LOC_DNS_SERVERS; }
| LOC_DNS_SEARCH { $$ = PT_LOC_DNS_SEARCH; }
| LOC_NIS_CONFIGSRC { $$ = PT_LOC_NIS_CONFIGSRC; }
| LOC_NIS_SERVERS { $$ = PT_LOC_NIS_SERVERS; }
| LOC_LDAP_CONFIGSRC { $$ = PT_LOC_LDAP_CONFIGSRC; }
| LOC_LDAP_SERVERS { $$ = PT_LOC_LDAP_SERVERS; }
| LOC_DEFAULT_DOMAIN { $$ = PT_LOC_DEFAULT_DOMAIN; }
| LOC_NFSV4_DOMAIN { $$ = PT_LOC_NFSV4_DOMAIN; }
| LOC_IPF_CONFIG { $$ = PT_LOC_IPF_CONFIG; }
| LOC_IPF_V6_CONFIG { $$ = PT_LOC_IPF_V6_CONFIG; }
| LOC_IPNAT_CONFIG { $$ = PT_LOC_IPNAT_CONFIG; }
| LOC_IPPOOL_CONFIG { $$ = PT_LOC_IPPOOL_CONFIG; }
| LOC_IKE_CONFIG { $$ = PT_LOC_IKE_CONFIG; }
| LOC_IPSECPOL_CONFIG { $$ = PT_LOC_IPSECPOL_CONFIG; }
| WLAN_BSSIDS { $$ = PT_WLAN_BSSIDS; }
| WLAN_PRIORITY { $$ = PT_WLAN_PRIORITY; }
| WLAN_KEYNAME { $$ = PT_WLAN_KEYNAME; }
| WLAN_KEYSLOT { $$ = PT_WLAN_KEYSLOT; }
| WLAN_SECURITY_MODE { $$ = PT_WLAN_SECURITY_MODE; }
%%