19 #ifndef HWSD_NETINFO_H
20 #define HWSD_NETINFO_H
22 #include <hwsd/nodeInfo.h>
24 #include <lunchbox/debug.h>
35 TYPE_UNKNOWN = LB_BIT_NONE,
36 TYPE_ETHERNET = LB_BIT1,
37 TYPE_INFINIBAND = LB_BIT2,
38 TYPE_LOOPBACK = LB_BIT3,
41 TYPE_ALL = LB_BIT_ALL_32
65 return !(*
this == rhs );
68 std::string getType()
const
72 case NetInfo::TYPE_ETHERNET:
74 case NetInfo::TYPE_INFINIBAND:
76 case NetInfo::TYPE_LOOPBACK:
79 return "TUNNEL_ETHERNET";
82 case NetInfo::TYPE_UNKNOWN:
90 void setType(
const std::string& strType )
92 if( strType ==
"ETHERNET" )
93 type = NetInfo::TYPE_ETHERNET;
94 else if( strType ==
"INFINIBAND" )
95 type = NetInfo::TYPE_INFINIBAND;
96 else if( strType ==
"LOOPBACK" )
97 type = NetInfo::TYPE_LOOPBACK;
99 type = NetInfo::TYPE_UNKNOWN;
129 inline std::ostream& operator << ( std::ostream& os,
const NetInfo& info )
131 os <<
"NetInfo\n" <<
static_cast< const NodeInfo&
>( info );
132 os <<
" Type " << info.getType() << std::endl;
133 os <<
" Status " << (info.
up ?
"UP" :
"DOWN") << std::endl;
134 if( !info.
name.empty( ))
135 os <<
" Name " << info.
name << std::endl;
137 os <<
" Hostname " << info.
hostname << std::endl;
139 os <<
" HWaddr " << info.
hwAddress << std::endl;
145 os <<
" Linkspeed " << info.
linkspeed <<
"Mbps" << std::endl;
151 #endif // HWSD_NETINFO_H