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 ------------------------------------------- */
15 #ifndef _FTA_NIC_DEF_H_INCLUDED__
16 #define _FTA_NIC_DEF_H_INCLUDED__
24 std::vector<std::string> opta; // option args
25 std::vector<std::string> optv; // val of option args
26 std::vector<std::string> typea; // legal types
27 std::vector<std::string> opba; // legal binary ops
28 std::vector<std::string> opua; // legal unary ops
29 std::vector<std::string> fieldsa; // illegal fields
30 std::vector<std::string> funca; // legal functions
34 bool legal_type(std::string t);
35 bool legal_unary_op(std::string t);
36 bool legal_binary_op(std::string t);
37 bool illegal_field(std::string t);
38 bool option_exists(std::string t);
39 std::string option_value(std::string t);
43 nic_property *load_nic_property(std::string dir, std::string name);
49 std::map<std::string, nic_property *> ndb;
51 nic_prop_db(std::string d){dir=d;};
54 nic_property *get_nic_property(std::string nics, int &err_no){
57 nic_property *ret = load_nic_property(dir, nics);
64 std::string get_nic_prop_val(std::string nics, std::string prop,int &err_no){
65 nic_property *nicp = this->get_nic_property(nics, err_no);
67 fprintf(stderr,"ERROR cannot load nic properties %s for nic type %s in get_nic_prop_val\n",nics.c_str(), prop.c_str());
70 if(nicp->option_exists(prop)){
71 return nicp->option_value("Return");
80 void NicParser_setfileinput(FILE *f);