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