1 /* ------------------------------------------------
2 Copyright 2014 AT&T Intellectual Property
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
7 http://www.apache.org/licenses/LICENSE-2.0
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ------------------------------------------- */
20 extern int NicParserparse(void);
21 extern FILE *NicParserin;
22 extern int NicParserdebug;
26 std::vector<std::string> nic_attr_vec;
27 std::vector<std::string> nic_val_vec;
28 std::string nic_a, nic_v;
32 nic_property *load_nic_property(std::string dir, std::string name){
36 fname = dir + "/nic_property_"+name+".def";
38 fname = "nic_property_"+name+".def";
40 FILE *nicf = fopen(fname.c_str(),"r");
42 fprintf(stderr,"ERROR, can't open nic property file %s\n",fname.c_str());
47 nicp = new nic_property();
48 NicParser_setfileinput(nicf);
50 fprintf(stderr,"could not parse nic property file %s\n",fname.c_str());
57 bool nic_property::legal_type(string t){
59 for(i=0;i<typea.size();++i){
67 bool nic_property::legal_unary_op(string t){
69 for(i=0;i<opua.size();++i){
78 bool nic_property::legal_binary_op(string t){
80 for(i=0;i<opba.size();++i){
88 bool nic_property::illegal_field(string t){
90 for(i=0;i<fieldsa.size();++i){
99 bool nic_property::option_exists(string t){
101 for(i=0;i<opta.size();++i){
109 string nic_property::option_value(string t){
111 for(i=0;i<opta.size();++i){