FREEDM DGI
SRemoteHost.hpp
Go to the documentation of this file.
1 
21 #ifndef REMOTEHOST_HPP
22 #define REMOTEHOST_HPP
23 
24 #include <string>
25 
26 #include <boost/lexical_cast.hpp>
27 
28 namespace freedm {
29 namespace broker {
30 
38 inline bool IsValidPort(std::string port)
39 {
40  try
41  {
42  int port_num = boost::lexical_cast<int>(port);
43  return port_num > 0 && port_num < 65535;
44  }
45  catch(boost::bad_lexical_cast&)
46  {
47  return false;
48  }
49 }
50 
53 {
54  std::string hostname;
55  std::string port;
56 };
57 
58 }
59 }
60 
61 #endif
bool IsValidPort(std::string port)
Definition: SRemoteHost.hpp:38
A container which lists the hostname and and port of a peer.
Definition: SRemoteHost.hpp:52
std::string hostname
Definition: SRemoteHost.hpp:54
General FREEDM Namespace.
Definition: CBroker.cpp:53
std::string port
Remote endpoint hostnames.
Definition: SRemoteHost.hpp:55