diff options
author | Hanoh Haim <hhaim@cisco.com> | 2015-10-18 16:16:39 +0300 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2015-10-18 16:16:39 +0300 |
commit | cf5dc18ecbeca6b4be9a171d996bba1cba9c3679 (patch) | |
tree | 435a2e1643b06fa4a0f5310e440e362f9e3d3b46 /src/utl_yaml.cpp | |
parent | ba9973506c1de58c87ccaa59798fb4e6252a186e (diff) |
another small fix for trex-130
Diffstat (limited to 'src/utl_yaml.cpp')
-rwxr-xr-x | src/utl_yaml.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/utl_yaml.cpp b/src/utl_yaml.cpp index 237e85af..5f3ca735 100755 --- a/src/utl_yaml.cpp +++ b/src/utl_yaml.cpp @@ -70,13 +70,15 @@ bool utl_yaml_read_ip_addr(const YAML::Node& node, std::string tmp; uint32_t ip; bool res=false; - try { + if ( node.FindValue(name) ) { node[name] >> tmp ; if ( my_inet_pton4((char *)tmp.c_str(), (unsigned char *)&ip) ){ val=PKT_NTOHL(ip); res=true; + }else{ + printf(" ERROR not a valid ip %s \n",(char *)tmp.c_str()); + exit(-1); } - }catch ( const std::exception& e ) { } return (res); } @@ -85,14 +87,11 @@ bool utl_yaml_read_uint32(const YAML::Node& node, std::string name, uint32_t & val){ bool res=false; - - try { + if ( node.FindValue(name) ) { node[name] >> val ; res=true; - }catch ( const std::exception& e ) { } return (res); - } bool utl_yaml_read_uint16(const YAML::Node& node, @@ -100,12 +99,10 @@ bool utl_yaml_read_uint16(const YAML::Node& node, uint16_t & val){ uint32_t val_tmp; bool res=false; - - try { + if ( node.FindValue(name) ) { node[name] >> val_tmp ; val = (uint16_t)val_tmp; res=true; - }catch ( const std::exception& e ) { } } @@ -113,10 +110,9 @@ bool utl_yaml_read_bool(const YAML::Node& node, std::string name, bool & val){ bool res=false; - try { + if ( node.FindValue(name) ) { node[name] >> val ; res=true; - }catch ( const std::exception& e ) { } return( res); } |