util: FaceUri: port numbers are 16 bits wide
Change-Id: I9568df121bac150bc98071820a5cd212fb22a458
diff --git a/src/util/face-uri.cpp b/src/util/face-uri.cpp
index fea4e16..f38e8c2 100644
--- a/src/util/face-uri.cpp
+++ b/src/util/face-uri.cpp
@@ -310,8 +310,8 @@
protected:
explicit
IpHostCanonizeProvider(const std::string& baseScheme,
- uint32_t defaultUnicastPort = 6363,
- uint32_t defaultMulticastPort = 56363)
+ uint16_t defaultUnicastPort = 6363,
+ uint16_t defaultMulticastPort = 56363)
: m_baseScheme(baseScheme)
, m_v4Scheme(baseScheme + "4")
, m_v6Scheme(baseScheme + "6")
@@ -334,15 +334,15 @@
return;
}
- uint32_t port = 0;
+ uint16_t port = 0;
if (faceUri->getPort().empty()) {
port = ipAddress.is_multicast() ? m_defaultMulticastPort : m_defaultUnicastPort;
}
else {
try {
- port = boost::lexical_cast<uint32_t>(faceUri->getPort());
+ port = boost::lexical_cast<uint16_t>(faceUri->getPort());
}
- catch (boost::bad_lexical_cast&) {
+ catch (const boost::bad_lexical_cast&) {
onFailure("invalid port number");
return;
}
@@ -375,8 +375,8 @@
std::string m_baseScheme;
std::string m_v4Scheme;
std::string m_v6Scheme;
- uint32_t m_defaultUnicastPort;
- uint32_t m_defaultMulticastPort;
+ uint16_t m_defaultUnicastPort;
+ uint16_t m_defaultMulticastPort;
};
class UdpCanonizeProvider : public IpHostCanonizeProvider<boost::asio::ip::udp>